-
Make button in movieclip target back to main/root timeline
Hello!
I have some submenu buttons in a movieclip on the mainline. My first level of navigation in on main timeline. The submenus are grouped in movieclips on the main timeline. I basically used the same code on the main navigation for the sub navigation except the code for the submenus is in that movie clip. My trace statement reads the button is clicked (which was a quantum leap for me) but I know I need some kind of _parent code in there so it knows to go to label back on main timeline. Can anyone help?? I feel like I am so close.
Thanks!!
Sandra
Here is my code that is on the submenu movieclip:
Code:
Code:
stop();
fall.addEventListener(MouseEvent.CLICK, clickSection);
spring.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection(evtObj:MouseEvent){
//trace shows what's happening... in the output window
trace ("The "+evtObj.target.name+" button was clicked!")
//go to the section clicked on...
gotoAndStop(evtObj.target.name);
}
-
Hi Sandra,
When referring to the main timeline or the root timeline (as your perfectly called it), you simply say _root.. So for example, you want to go a certain frame on the main timeline when you clicked a button within a movieclip, you would say:
PHP Code:
_root.gotoAndStop(3);
-
Originally Posted by Osteel
Hi Sandra,
When referring to the main timeline or the root timeline (as your perfectly called it), you simply say _root.. So for example, you want to go a certain frame on the main timeline when you clicked a button within a movieclip, you would say:
PHP Code:
_root.gotoAndStop(3);
That is AS2, and won't work in an AS3 script...
There is a litle trick to recreate the _root functionality...
Code:
var _root:MovieClip = MovieClip(root)
but really AS3 uses a different architecture and trying to do things the same in AS3 as in AS2 is likely to cause you headaches down the line...
-
Oh, I didn't realize it was AS3.
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
|