Basic LoaderMax XML Loading setup


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import com.greensock.*;
  2. import com.greensock.loading.*;
  3. import com.greensock.events.LoaderEvent;
  4.  
  5. var queue:LoaderMax = new LoaderMax({name:"mainQueue", onComplete: onQueueComplete /*,onProgress:progressHandler */ });
  6. queue.append( new XMLLoader("site.xml", {name:"siteXml", onComplete: onXMLReady }) );
  7. queue.load();
  8.  
  9.  
  10. function onXMLReady(e:LoaderEvent):void {
  11.  
  12. var self = e.currentTarget.content;
  13. for(var i in self.myNode){
  14. var nodeContent = self.myNode[i];
  15. trace(nodeContent);
  16.  
  17. // queue.append( new SWFLoader(self.myNode[i].@swf, {onComplete: onSWFLoaded }) );
  18.  
  19. }
  20.  
  21. }
  22.  
  23. function onQueueComplete(e:LoaderEvent):void {
  24. trace("Loading Queue is Complete");
  25. }
  26.  
  27. /*
  28. function progressHandler(event:LoaderEvent):void {
  29.   trace("progress: " + event.target.progress);
  30. }
  31. */

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.