----- Original Message ----
> From: "Merrill, Jason" <[email protected]>
> To: Flash Coders List <[email protected]>
> Sent: Thu, May 13, 2010 2:11:39 PM
> Subject: RE: [Flashcoders] Event Listeners
>
> To answer your question, it's a matter of a where and a when which are
not
> apparent in your sample code. Where is the event
> Event.COMPLETE
dispatched from container_middle2? When does that event
> fire? Are you
possibly assigning the listener after the event has already
> fired?
How stupid of me. I made this far more complex than I need. Forget that
handler. All I need is this:
AllDone();
Duh.
Sorry.
John
Jason Merrill
Bank of America
> Global Learning
Learning & Performance Solutions
Join the Bank of
> America Flash Platform Community and visit our
Instructional Technology
> Design Blog
(note: these are for Bank of America employees
> only)
-----Original Message-----
From:
> ymailto="mailto:[email protected]"
> href="mailto:[email protected]">[email protected]
[mailto:
> ymailto="mailto:[email protected]"
> href="mailto:[email protected]">[email protected]]
>
> On Behalf Of John
Singleton
Sent: Thursday, May 13, 2010 2:06 PM
To:
> ymailto="mailto:[email protected]"
> href="mailto:[email protected]">[email protected]
Subject:
> [Flashcoders] Event Listeners
Hi;
I struggle with event listeners and
> knowing to what objects to attach
them. I have the following
> code:
function SpinMiddle()
> {
> big_container.addChild(container_middle2)
> var path:String = "images/mid" + j + ".png";
> var req:URLRequest = new URLRequest(path);
> var loader:Loader = new Loader();
> loader.load(req);
>
> loader.addEventListener(IOErrorEvent.IO_ERROR,
function(e:IOErrorEvent):void{
> trace(e) });
>
> loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
SpinMiddleLoaded);
> }
> function SpinMiddleLoaded(evt:Event):void
> {
var loaderInfo:LoaderInfo =
> evt.target as LoaderInfo;
var
> displayObject:DisplayObject = loaderInfo.content;
> displayObject.width = 319;
> displayObject.height = 502;
> container_middle2.addChild(displayObject);
> container_middle2.x = 349;
> container_middle2.y = -482;
> mid_done = true;
var rand:Number =
> new Number(randomNumber(300, 500));
> var timeline:TimelineLite = new
> TimelineLite({onComplete:
RemoveMiddle()});
> timeline.append(new TweenLite(container_middle,
> rand/100,
{alpha: 1}));
> timeline.append(new TweenLite(container_middle, 1,
> {x:349,
y:522}));
var
> timeline2:TimelineLite = new TimelineLite();
> timeline2.append(new TweenLite(container_middle2,
> rand/100,
{alpha: 1}));
> timeline2.append(new TweenLite(container_middle2, 1,
> {x:349,
y:20}));
}
>
function RemoveMiddle()
> {
> container_middle2.addEventListener(Event.COMPLETE, AllDone);
> }
AllDone() is never called,
> even though a trace in RemoveMiddle() traces.
I've tried replacing
> container_middle2 with big_container in
RemoveMiddle() but with no luck.
> Please advise.
TIA,
John
>
_______________________________________________
Flashcoders mailing
> list
> href="mailto:[email protected]">[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders
> mailing list
> href="mailto:[email protected]">[email protected]
> href="http://chattyfig.figleaf.com/mailman/listinfo/flashcoders"
> target=_blank
> >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders