Hey, it’s been a while since posting here, but I’ve learned a lot from these forums. I’ve been switching over to AS3 on all of my Flash projects but I have some problems regarding loading and accessing loaded movieclips.
I have this in a class, outside of my Document class. My document class is called Main.as and there is a public static var called ‘displayRoot’ that is ‘this.stage’ in the Document class.
So loading in a swf in my LoaderClass.as I’ll do this:
private var kioskMenu:MovieClip = new MovieClip();
private var urlMenu:URLRequest = new URLRequest("menu.swf");
private function loadAssetMenu():void
{
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, menuLoadingListener);
ldr.load(urlMenu);
}
private function menuLoadingListener(evt:Event):void
{
kioskMenu = evt.target.content;
Main.displayRoot.addChild(kioskMenu);
// There is a mc inside menu.swf called mcBackground and I reference it like this, which works and I don't know another way to do so.
kioskMenu["mcBackground"].alpha = 0;
}
Now this all works, it loads what I need and makes that background movieclip invisible. But I have a DisplayManager that extends a movieclip and has imported the Main Document class so it can access my ‘displayRoot’ var with this method:
public static function showMenu():void
{
trace("Showing Menu");
trace(Main.displayRoot.getChildByName("kioskmenu"));
}
This method returns a ‘null’. How do I, from a different class then what added a movieclip to the stage, access that movieclip that now resides on the stage. It’s on the stage, I can see it’s content. I am using TweenMax and my DisplayManager class needs to make this exact call to fade up my menu:
TweeMax.to(Path to movieclip, 1, {alpha: 1});
But I have no clue how to access that movie clip from the DisplayManager class nor do I know how to access movieclips nested inside this one. Since this particular project is coming down to the wire, I’m going to rewrite it in AS2 in 1/4th of the time. I am a decent programmer, I have an understanding of OOP - just some light shed here would be most helpful.
Thanks. :afro: