Jump to content


.rawContent is null on a loaded swf.

Recommended Posts

Hi there I am trying to load a swf that is just a simple timeline animation.


After the onComplete callback of the SWFLoader fire the SWFLoader has a correct rawContent property.


If I call




That .rawContent property is null. 


Am I doing something wrong. 


Pretty much what I want to do is call.LoaderMax.getContent("some_id").rawContent then handle that content differently based on whether it is a Bitmap or a MovieClip.



Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.


It seems like you have a good grasp of how things work. 

These are the various types of rawContent per loader type:


The raw content that was successfully loaded into the content ContentDisplay Sprite which varies depending on the type of loader and whether or not script access was denied while attempting to load the file:
  • ImageLoader with script access granted: flash.display.Bitmap
  • ImageLoader with script access denied: flash.display.Loader
  • SWFLoader with script access granted: flash.display.DisplayObject (the swf's root)
  • SWFLoader with script access denied: flash.display.Loader (the swf's root cannot be accessed because it would generate a security error)




It would probably help to see a super simple example of your files that shows rawContent being null after a file loads.


I'm guessing there might be a problem in the way you are trying to access the loader, but its hard to tell without something to test.


You can zip your files and attach them using "more reply options". Just include the file doing the loading and the file being loaded. Thanks.

Link to comment
Share on other sites

First I create a SWF Loader with the following

var swfVars:SWFLoaderVars = new SWFLoaderVars();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;					
swfVars.onOpen( onSWFStartLoading );
swfVars.onComplete( onSWFCompleted );
if (ar.id) {
     swfVars.name( ar.id );

var sf:SWFLoader = new SWFLoader(ar.path, swfVars);
return new SWFLoader(ar.path, swfVars);

When that swf is done I just trace the following - everything looks fine, rawContent IS NOT null.

var l:SWFLoader = e.target as SWFLoader;
trace(l.content, l.rawContent, l.name, l.scriptAccessDenied);

Then later I simply do the following with data.@img being the same name as the loader above.  Here tracing getContent() displays 'ContentDisplay' and .rawContent is null

Link to comment
Share on other sites

As another point when I trace out the following details about the SWF loader I get some strange results.

rawContent: null, autoDispose:false,bytesLoaded:0, bytesTotal:20000,status:0,progress:0,autoDispose:false

Again this is practically righht after the SWFLoader onComplete event fires when all the above properties are just like they should be,

Link to comment
Share on other sites

Figured it out, it was all my fault.  In the portion where I was creating my SWF loader i was actually creating 2 instances.  Switched to 1 instance and everything works fine.  Thank you

Link to comment
Share on other sites

Thanks for the additional info. Certainly sounds a bit strange.


A very simple set of files that has a single SWFLoader that shows rawContent = null after its onComplete fires will be a big help. We don't need your production files or anything that contains dynamic features (xml loading and parsing). Just something super simple.



Link to comment
Share on other sites



Looks like you figured it out right before my follow-up.


Glad you got it working, thanks for letting us know

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.