-
1. Re: Object-oriented Event.COMPLETE programming
kglad Mar 9, 2011 6:34 PM (in response to barpos)1) Will the code past the .LOAD line (in red) be executed only after the image completes loading?
not unless that code is in a listener function
2) Can I nest several listeners as seeing in my code below?
yes.
-
2. Re: Object-oriented Event.COMPLETE programming
barpos Mar 9, 2011 7:15 PM (in response to kglad)How about the following code? Would addChild be executed?
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("Circle.swf");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
addChild(ldr);
function loaded(event:Event):void
{
var content:Sprite = event.target.content;
content.scaleX = 2;
} -
3. Re: Object-oriented Event.COMPLETE programming
kglad Mar 9, 2011 10:05 PM (in response to barpos)yes, but you won't see anything until loading is complete.
-
4. Re: Object-oriented Event.COMPLETE programming
barpos Mar 10, 2011 2:58 AM (in response to kglad)But, won't that be the same if I placed the addChild line in the event.complete listener?
-
5. Re: Object-oriented Event.COMPLETE programming
kglad Mar 10, 2011 6:14 AM (in response to barpos)no it's not the same, but you won't see any difference unless you're doing certain other things that i don't see you doing.
-
6. Re: Object-oriented Event.COMPLETE programming
barpos Mar 10, 2011 7:11 AM (in response to kglad)Ok, to be on the safe side, I'll put everything in the listeners.
Regards,
Ron
-
7. Re: Object-oriented Event.COMPLETE programming
kglad Mar 10, 2011 4:28 PM (in response to barpos)you're welcome.


