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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders