Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing parent properties/methods in Actionscript 3.0

I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error:

root.play();

"1061: Call to a possibly undefined method play through a reference with static type flash.display:DisplayObjectContainer."

Using the Stage class also doesn't work:

stage.play();

"1061: Call to a possibly undefined method play through a reference with static type flash.display:Stage."

Is there any way to do this?

like image 802
pypmannetjies Avatar asked Nov 19 '25 22:11

pypmannetjies


1 Answers

You need to cast it to a MovieClip

(root as MovieClip).play()
like image 86
Andres Avatar answered Nov 22 '25 03:11

Andres



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!