Jump to content
Search Community

how to fire event when getContent complete?

mspanish test
Moderator Tag

Recommended Posts

Hello guys! I am having a bit of trouble timing something, as I'm not sure how to listen for a getContent = completely loaded event.

 

Here is my code adding the image to the stage:

 

var thumb:ContentDisplay = LoaderMax.getContent(thumbnailBigArray);

 

I need another event to fire ONLY when the rawContent is available.

 

thanks a ton in advance!

Stacey

Link to comment
Share on other sites

I need another event to fire ONLY when the rawContent is available.

 

have you tried putting an onInit listener on the ImageLoader?

 

onInit : Function - A handler function for LoaderEvent.INIT events which are called when the image has downloaded and has been placed into the ContentDisplay Sprite. Make sure your onInit function accepts a single parameter of type LoaderEvent (com.greensock.events.LoaderEvent).

 

http://www.greensock.com/as/docs/tween/ ... oader.html

 

something like:

 

var someImage:ImageLoader = new ImageLoader("image.jpg", {name:"fred", onInit:initHandler});

 

--

 

I don't know if I am following your question totally.

 

getContent() doesn't have any events associated with it and doesn't handle adding objects to the stage. its just a convenience method for getting a reference to a particular loader's content.

 

i imagine that once you do:

 

var thumb:ContentDisplay = LoaderMax.getContent(thumbnailBigArray[i]);

 

you are following it up with something like:

 

addChild(thumb);

 

---

 

perhaps what you are looking for is the AS3 event ADDED_TO_STAGE?

 

thumb.addEventListener(Event.ADDED_TO_STAGE, doSomething);

 

the above code would have to run before the thumb is added to the stage.

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...