R – How to control main timeline from external swf

actionscript-3flash

I have a main.swf and inside it is just a plain container movieclip. Using the Loader function I load an external swf called content.swf inside that container. Container.swf has a button inside it.
Now when external swf is loaded in container mc which is on the main.swf stage, I want to move to another frame by clicking the button of the loaded external swf.
If I try to control it from the main timeline I get error saying

cannot convert flash.display::Loader@117e7041 to flash.display.MovieClip.

If I try to control it from the external swf I can trace the click on the button but timeline doesn't move to the wanted frame.

Best Answer

From the error message it seems that you are trying to cast a loader into a movie clip. Use the loader.content property instead.

var mc:MovieClip = loader.content as MovieClip;
//do whatever you want with mc
Related Topic