Jump to content
Search Community

casting returned ContentDisplay as MovieClip? Help??

adamwilks test
Moderator Tag

Recommended Posts

Hi folks, [sOLVED SEE LAST POST]

 

I hope one of you GreenSock warrirors will be able to help me out, I'm new to LoaderMax?

I've got an XMLLoader which, in turn, auto creates SWFLoaders...

The SWFs that are being loaded are very simple. Just a bunch of bitmaps on the root timeline, flickbook style animations. ;-)

I can't seem to cast the SWFLoader's ContentDisplay objects as MovieClip objects, as I want to do some timeline manipulation on the loaded SWFs. I've had a good look through the various forum threads... but to no avail ;-( Is my concept wrong? What am I missing?

This has consumed so much of my brain, that I've actually just walked out of a supermarket without paying, I fear I'll end up in the slammer if I don't suss this out!

(PS Jack, keep up the good work.... "Lord GreenSock for President!")

Regards

 

Here's my xml...

<?xml version="1.0" encoding="iso-8859-1"?>



 

Here's my init method...

public function build(mc:MovieClip):void {
container = mc; // class instance var
LoaderMax.activate([sWFLoader]);
xmlLdr = new XMLLoader("config.xml", {name:"xmlLdr", noCache:true, onComplete:completeHandler});
xmlLdr.load();
}

 

Here's my completeHandler...

private function completeHandler(event:LoaderEvent):void {
var thumbnail:ContentDisplay;
var mc:MovieClip;
var swfs:XMLList = (xmlLdr.content as XML).SWFLoader;

for each (var swf:XML in swfs) {
	thumbnail = LoaderMax.getContent(swf.@name); // ContentDisplay
	//mc = thumbnail as MovieClip; <<???
	container.addChild(thumbnail); // be good to pass in mc?
	thumbnail.x = swf.@SwfXPos;
	thumbnail.y = swf.@SwfYPos;
}

}

Link to comment
Share on other sites

hi carl,

thanks for getting back to me.

yeh, I've had a good read through all the tips-n-tricks.

 

and also tried>> thumbnail = LoaderMax.getContent(swf.@name).rawContent;

 

I think my problem maybe that the swf's I'm loading were created for AS2 FlashPlayer 8 and I'm loading them into an AS3/player 10 container?

I'm just doing some reading up on this.... AVM1 vs AVM2....?? this is new to me.

any thoughts?

regards

Link to comment
Share on other sites

GOTCHA SOLVED!

 

For any one else....

If you're using a SWFLoader to load in external SWFs and you want access to the rawContent (ie the loaded MovieClip and it's methods)...

Make sure your SWFs-to-be-loaded are exported for AS3 NOT AS2 or you'll not be able to cast as MovieClips and you won't be able to access the loaded SWFs timeline etc.

 

Hope this helps someone else.

 

Happy GreenSocking ;-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...