Simple little loader utility


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

When you just need something small and simple.


Copy this code and paste it in your HTML
  1. initLoad();
  2.  
  3. function initLoad() : void
  4. {
  5. var contentLoader : Loader = new Loader();
  6. var s : Sprite = new Sprite();
  7. var link : String = "http://isokon.net/post/cloudvcloud.jpg";
  8.  
  9. // here we are adding the child of what the utility returns
  10. s.addChild( load( link, contentLoader ));
  11. addChild(s);
  12. }
  13.  
  14. // the loading utility
  15. function load( url:String, l:Loader ) : Loader {
  16. l.load( new URLRequest( url ) );
  17. return l;
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.