Jump to content
GreenSock

scratch

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Newbie
  1. Hi, thanks for your quick answer. I read about this parameter, but thougt it is set to false by default. You and the docs corrected me skipFailed : Boolean If skipFailed is true (the default), any failed loaders in the queue will be skipped. lmaxMain.skipFailed = false; Is working great! Thank you scratch
  2. Hi, the docs say (important part highlighted red): onComplete : Function - A handler function for LoaderEvent.COMPLETE events which are dispatched when the loader has finished loading successfully. Make sure your onComplete function accepts a single parameter of type LoaderEvent (com.greensock.events.LoaderEvent). Code: //create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners lmaxMain = new LoaderMax({name:"lmaxMain",maxConnections:1,onProgress:onLMaxProgress,onChildComplete:onLMaxChildComplete,onComplete:onLMaxComplete,onError:onLMaxError}); //append several loaders lmaxMain.append(new ImageLoader("logo.png", {name:"logo",estimatedBytes:3000,container:this,alpha:0,width:300,height:200,scaleMode:"proportionalInside"} )); lmaxMain.append(new ImageLoader("intro.png1", {name:"intro",estimatedBytes:13000,container:this,alpha:0,width:800,height:600,scaleMode:"proportionalInside"} )); //prioritize the loader named "intro" LoaderMax.prioritize("intro",false); LoaderMax.prioritize("logo",false); //start loading lmaxMain.load(); private function onLMaxProgress(event:LoaderEvent):void { trace("Main.onLMaxProgress - Progress: " + event.target.progress); } private function onLMaxChildComplete(event:LoaderEvent):void { trace("Main.onLMaxChildComplete - Name: " + event.target.name); if(event.target.name == "logo") { var image:ContentDisplay = LoaderMax.getContent("logo"); image.x = stage.stageWidth / 2 - image.width / 2; image.y = stage.stageHeight / 2 - image.height / 2; TweenNano.to(image,1,{alpha:1}); trace("Main.onLMaxChildComplete - Logo added to screen."); } } private function onLMaxComplete(event:LoaderEvent):void { trace("Main.onLMaxComplete - Complete: " + event.target + " is complete!"); } private function onLMaxError(event:LoaderEvent):void { lmaxMain.cancel(); trace("Main.onLMaxError - Error: " + event.text); } Output: Main.onLMaxProgress - Progress: 0.18505516549648948 Main.onLMaxChildComplete - Name: logo Main.onLMaxChildComplete - Logo added to screen. Main.onLMaxProgress - Progress: 1 [color=#FF0000]Main.onLMaxComplete - Complete: LoaderMax 'lmaxMain' is complete![/color] ---- Error on ImageLoader 'intro' (intro.png1): Error #2035: URL not found. URL: file:///C|/intro.png1 ---- Main.onLMaxError - Error: ImageLoader 'intro' (intro.png1) > Error #2035:URL not found. URL: file:///C|intro.png1 Why is onComplet fired? There was an error during loading. Thanks scratch
×