-
[RESOLVED] nav with timeline label
i have a problem here. i am using a simple structure by using a navTo variable as a string to find my frame label within the variable and a play() method. my problem is when i click off my home page and navigate to my gallery page then maybe navigate back to my links page my timeline always defaults back to my home page first resulting in a double click to get to my page of choice. below is the code and if anyone can see the problem and point it out to me i would be most thankful.
Actionscript Code:
var navTo:String = "";
//add button event listeners
home.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);
about.addEventListener (MouseEvent.CLICK, navigate, false, 0, true); gallery.addEventListener (MouseEvent.CLICK, navigate, false, 0, true); links.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);
//define the function each button will call function navigate (e:MouseEvent):void { //the destination frame label is derived from the name of the button clicked navTo = e.target.name; play (); }
-
I'm missing the part that tells it to actually go anywhere. Calling play() will just make the timeline play through...Do you mean to have something like gotoAndPlay(navTo)?
-
i tried gotoAndPlay(navTo), and i get this response in my compiler errors: 1137: Incorrect number of arguments. Expected no more than 0. in my timeline i am using labels that correspond to my button names. i believe by defining my function by calling
Actionscript Code:
navTo = e.target.name; play();
should be looking for each label as it scrubs my timeline. it does, but it only works once. example: i click from home page to my links page, and it works. however, i click from my links page to my about page the code takes me back to my home page unless i click my about link a second time. this is where my trouble is executed leaving me clueless as to how to solve. i am using another code on the timeline as well that takes me to my home page from my splash page. it looks like this:
Actionscript Code:
this.addEventListener(MouseEvent.CLICK, goToHome); function goToHome(e:MouseEvent):void{ this.gotoAndPlay("home"); }
i took apart my navigation and built a new file using the a fore mentioned code and it works fine. my conclusions are drawing to the fact that something is conflicting between the splash page (banner) link and my navigation. if that is the case i am again at a loss. i tried working a function in with my string for the banner link as follows:
Actionscript Code:
home_header.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
, but that failed as well.
-
resolved rdoyle720. i just used the frame label name as the keyword in my method instead of the shorthand reference. thanks for your response.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|