Hello everyone, I am stuck with AS3 migration:
I’ve defined a variable outside my function, then I want to call the variable to become a certain movie clip, but it doesn’t work.
Here is a simple example of my code:
//setting playClip variable to be movieclip
var [COLOR="red"]playClip[/COLOR]:MovieClip;
mybtn.addEventListener(MouseEvent.CLICK, playAnim);
function playAnim(e:MouseEvent):void {
[COLOR="red"]playClip [/COLOR]= myClip;
myClip_animator.play();
}
//the function should be executed on playClip
//this is a long function I didn't paste it in
var myClip_animator:Animator = new Animator(myClip_xml, [COLOR="Red"]playClip[/COLOR]);
If I set the variable outside the function it will work. How do I set the variable to work outside the function?
Thanks