Hey I’m fairly new to AS3. Here’s my issue.
lets say for example, on the main time line i have a function
[COLOR=RoyalBlue]function myFunction(num:Number)
{
trace(num);
}
[COLOR=Black]and I add a movie clip btnSm to the stage like this.
[COLOR=RoyalBlue]var btnSm:MovieClip = new BtnSmall();
stage.addChild(btnSm);
[/COLOR][/COLOR][/COLOR]
and lets say inside btnSm’s timeline has an event that calls myFunction on mouse click, for example
[COLOR=RoyalBlue]var btnNumber;
this.addEventListener(MouseEvent.CLICK, gotoLink);
function gotoLink(event:MouseEvent)
{
trace(btnNumber);
stage.[/COLOR][COLOR=RoyalBlue]myFunction(btnNumber);
}
[/COLOR]
and This wont work for me. I tried root.myFunction(btnNumber)
I tried MovieClip(root).myFunction(btnNumber), none would work.
[COLOR=Red]So, How can I access a function on the main timeline in AS3? [/COLOR] In AS2.0 you can do this by _root.myFunction();
appreciate your help
thank you