Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
agirlcreative

LoaderMax into layers

Recommended Posts

HI!

 

So I'm not a fantastic flash coder.. but I'm in the middle of a project that I need a little help on. I have some code, which works very well, with one thing that I cannot figure out how to change. I'd like to be able to put other art on top of the loaded SWF.. but it only loads in the topmost "z" index, and even if I put another layer over the top with art to overlay, it just loads over it..

 

var queueb1:LoaderMax = new LoaderMax({onProgress:progressHandlerb1, onComplete:completeHandlerb1, onError:errorHandlerb1});
queueb1.append( new SWFLoader("whitley.swf", {name:"whitleySWF", estimatedBytes:3000, container:this, autoPlay:false}) );
queueb1.load();
 
function progressHandlerb1(event:LoaderEvent):void {
    trace("progress: " + event.target.progress);
}
 
function completeHandlerb1(event:LoaderEvent):void {
    var image:ContentDisplay = LoaderMax.getContent("whitleySWF");
image.x=0;
image.y = -65;
    trace(event.target + " is complete!");
}
 
function errorHandlerb1(event:LoaderEvent):void {
    trace("error occured with " + event.target + ": " + event.text);
}
 
Can you tell me what I need to do to this code so it loads on a specific layer? I also have a symbol that I've been using as a mask, it'd be perfect if I could load it into it.
Link to comment
Share on other sites

Yes, instead of using container:this, you can specify ANY DisplayObjectContainer to load into (typically a MovieClip or Sprite). 

 

When you use container:this, the loaded item just gets loaded on the next available stacking index. If you use your own container movie clip, its very easy to place that container above or below other assets. To place an object above your loaded swf in its custom container just use addChild()

//create a new movie clip with actionscript or use one from the library
var holder = new MovieClip();
addChild(holder);

var swf:SWFLoader = new SWFLoader("someSwf", {container:holder});

addChild(someOtherClip); //will go on top of holder

swf.load();

You can read more about depth management here:

http://evolve.reintroducing.com/2008/02/27/as2-to-as3/as2-%E2%86%92-as3-depth-management/

 

http://www.flashandmath.com/intermediate/depths/

 

http://www.emanueleferonato.com/2008/03/29/understanding-howas3-manages-depths/

  • Like 1
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.
×