Jump to content
Search Community

Monitor array assets loading

dnbly test
Moderator Tag

Recommended Posts

Hi all,

I am very new to loadermax and fairly inexperienced with AS3 so apologise if I have missed or misunderstood some documentation that explains this.

I am currently using SWFLoader to load 3 external swfs into a main swf. I have constructed a preloader in this main swf that 'draws' a ring using masking. The ring currently tracks the load progress of the whole queue (see code below) however I want it to track the load progress of Atoms.swf. The ultimate aim is to repeat this for the other array assets.

//Load external SWFs into queue
LoaderMax.activate([SWFLoader]);
var urls:Array = ["Atoms.swf","Compounds.swf","Quiz.swf"];
var queue:LoaderMax = LoaderMax.parse(urls);
var swfs:Array = queue.content;
queue.load();

queue.addEventListener(ProgressEvent.PROGRESS, onLoading);
function onLoading(event:LoaderEvent):void
{
//set variables to calculate ring rotation
var loaded1:Number = event.target.progress;
var counter1=(loaded1*100)*3.6;

//mask one semi-ring over the other
masked1_mc.mask=masking1_mc;
masked1_mc.rotation=counter1;
if(masked1_mc.rotation<0){
masked1_mc.mask=null
}

My reasoning tells me that the event.target.progress needs to be changed to track the asset loading however I am unsure what code (if any) would accomplish this. I have considered just hard-coding a ratio of queue progress to swf size for each asset but would really prefer something a bit more dynamic (so I don't need to change it when I update the external swfs in future).

 

I realise that this may not be the best implementation of loadermax however it currently works and I would prefer not to change it unless necessary. Sorry if this seems a bit long winded, I would really appreciate a speedy response for some enlightenment in this matter.

 

Thanks for LoaderMax, the whole of GreenSock and helpful responses.  :-P

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

Congrats on your success with LoaderMax.

 

To get the progress or the children of your LoaderMax, you can listen for the CHILD_PROGRESS event like so

queue.addEventListener(LoaderEvent.CHILD_PROGRESS, onChildProgress);

function onChildProgress(e:LoaderEvent):void {
  trace(e.target, e.target.progress);
}

In addition to studying the LoaderMax docs, I would suggest you take a peak at this video and tutorial: http://www.snorkl.tv/2011/08/loading-images-with-loadermax-load-and-track-the-progress-of-multiple-images/ as it shows many of the properties and methods of the items in the LoaderMax classes.

  • Like 1
Link to comment
Share on other sites

Thanks so much. I can't believe I missed that!

 

Just need to figure out a method to update the rotation of the seperate rings based on each childs load progress (i.e. ring1 only rotates as child1 loads, ring2 only updates as child2 loads etc).

 

UPDATE: Success! I have a fully working ring preloader that tracks the seperate array children loading. Thanks for everything LoaderMax and Carl!

  • Like 2
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...