Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Navigation problem

This is a discussion on Navigation problem within the Actionscript 3.0 newbies forums, part of the Flash CS3 eng category; Hy there, i got a problem with my navigation and i´m working since hours to get that b*** done ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > Actionscript 3.0 newbies

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-05-08, 21:37
Junior Member
 
Join Date: May 2008
Posts: 25
Rep Power: 0
madmad is on a distinguished road
Navigation problem

Hy there,

i got a problem with my navigation and i´m working since hours to get that b*** done
Please! Somebody - help me out!

I wrote a menu with some files of this form and combined it with a sliding menu.
So, what happens is, that you rollOver that menu, menu comes out and you can choose to open some sub menues. they also slide from the side.

When you rollOut of that menu, both the menu and submenu slide back and stay.

If one rolls again over the menu, menu comes out with chosen submenu.

There is the problem:

at that point, when i chose again another submenu, the submenu chosen before stays.
It should automaticay swap with the new chose

So i attached the file, maybe you could look at it and help me.

Thx
Attached Files
File Type: zip navigation_problem.zip (10.0 KB, 5 views)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 12-05-08, 10:52
Junior Member
 
Join Date: May 2008
Posts: 25
Rep Power: 0
madmad is on a distinguished road
Re: Navigation problem

Ok, heres the code:

Code:
stop();

import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;


var menu_array:Array;
var section_array:Array;
        
var currentSection:int=0;
var nextSection:int;

init();
        
function init():void
        {
            menu_array=new Array(menu_btn.sub_links.empty_mc,menu_btn.sub_links.artists_btn,menu_btn.sub_links.projects_btn,menu_btn.sub_links.news_btn,menu_btn.sub_links.contact_btn);
            section_array=new Array(sub_mc.empty,sub_mc.section1_mc,sub_mc.section2_mc,sub_mc.section3_mc,sub_mc.section4_mc);
            
            stopAll();
            
            addMenuEvents();
            
            hideCurrentSection();
        }
        
function stopAll():void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {
                menu_array[i].stop();
                section_array[i].stop();
            }
        }
        
function addMenuEvents():void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {
                menu_array[i].mouseChildren=false;
                menu_array[i].buttonMode=true;
                
                menu_array[i].id=i;
                menu_array[i].isPressed=false;
                
                menu_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
                menu_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
                menu_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                menu_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
            }
        }
        
function setOver(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(2);
        }
        
function setOut(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(1);
        }
        
function setDown(evt:MouseEvent):void
        {
            nextSection=evt.target.id;
            checkState(evt.target.id);
            
            evt.target.gotoAndStop(3);
            hideCurrentSection();
            
            currentSection=evt.target.id;
        }
function setUp(evt:MouseEvent):void
        {
            if(evt.target.isPressed==false)
                evt.target.gotoAndStop(1);
        }
        
function checkState(n:int):void
        {
            for(var i:int=0;i < menu_array.length;i++)
            {    
                menu_array[i].buttonMode=false;
                menu_array[i].removeEventListener(MouseEvent.MOUSE_DOWN,setDown);
                if(i==n)
                    menu_array[i].isPressed=true;
                else
                {
                    menu_array[i].isPressed=false;
                    menu_array[i].gotoAndStop(1);
                }
            }
        }
        
function hideCurrentSection():void
        {
            section_array[currentSection].gotoAndPlay(21);
            showSection();
        }
        
function showSection():void
        {
            section_array[nextSection].gotoAndPlay(2);
            section_array[nextSection].addEventListener(Event.ENTER_FRAME,checkFrame);
        }
        
function checkFrame(evt:Event):void {
            if(evt.target.currentFrame==19)
            {
                evt.target.removeEventListener(Event.ENTER_FRAME,checkFrame);
                for(var i:int=0;i < menu_array.length;i++)
                {
                    menu_array[i].buttonMode=true;
                    menu_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                }
            }
}
        

var rewind:Boolean;

this.hitArea = this.hit;
this.buttonMode = true;


this.addEventListener(Event.ENTER_FRAME, ef);
this.addEventListener(MouseEvent.ROLL_OVER, roll_over);
this.addEventListener(MouseEvent.ROLL_OUT, roll_out);

function ef(event:Event) {
    if(rewind) this.prevFrame();
}

function roll_over(event:MouseEvent):void {
    rewind = false;
    this.play();
}

function roll_out(event:MouseEvent):void {
    rewind = true;
}
somehow i think that animation at mouseOut looses information over the hited menu point and that why not swapping withe another chosen menu point????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 12-05-08, 13:49
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,446
Rep Power: 6
Flep is on a distinguished road
Re: Navigation problem

Hi,
keep the main timeline with one frame only.

With actual structure, every time the timeline goes to frame 1 Flash executes the code of frame 1.

Put your MovieClips inside an holder MovieClip and command it.
Main timeline must have always one frame only.
__________________

 


I recommend: Essential Actionscript 3.0

- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
- I do not reply technicians pvt messages. Open a thread !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 12-05-08, 18:53
Junior Member
 
Join Date: May 2008
Posts: 25
Rep Power: 0
madmad is on a distinguished road
Re: Navigation problem

Great! It works!!!


Thx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Flash CS3 help with music problem merlin Flash CS3 eng 0 15-07-08 01:27
Photoshop CS3 Creating a navigation menu Flep PhotoShop ENG 1 23-06-08 09:12
Need help in navigation system rashid Flash CS3 eng 1 04-06-08 14:54
I've "SCENE" better days...Scene Navigation Help Please!!! kedeLABS Flash CS3 eng 1 03-12-07 07:17
Navigation noob p_su Actionscript 3.0 newbies 11 26-08-07 07:39


All times are GMT. The time now is 13:35.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406