- build in some traces
- I won't dive in your code sice it has a weird structure and a lot of if else cases that can go wrong easily;
- work with states.
- You might want to make a clear reset(state:String) function that resets all back to a certain state before starting again.

But maybe start checking on the alpha and also if it is staged.
trace(XXXContainer.alpha, XXXContainer.stage,XXXContainer.visible)

Also make sure your Tweens don't overwrite each one another.
OverwriteManager.init(OverwriteManager.AUTO)

Ciao,
Latcho

On 17-05-10 18:28, jonathan howe wrote:
Tha'ts a lot of code for email. Any way you can isolate the problem for us?

-jonathan


On Sat, May 15, 2010 at 1:36 PM, John Singleton
<johnsingleton...@yahoo.com>wrote:

Full View
Hi;
I have the following code. When
it runs through BigContainer the second time, for some reason my
containers disappear and nothing shows on the screen. This happens even
if I take out my removeChild statements, and that's what's got me
puzzled. Ideas?

        var start_flag:Boolean = true;
        var start_flag2:Boolean = true;

        function
BigContainer()
        {
            if(start_flag == false)
            {
                start_flag2 = false;
            }
            if(start_flag == true)
            {

LoadImages();
                start_flag = false;
            }
            else
            {
                if(i == 4)
                {
                    i = 1;
                }
                else if(i == 3)
                {
                    j = 1;
                }
                var timeline:TimelineLite =
new TimelineLite({onComplete:LoadImages()});

timeline.append(new TweenLite(container_left, 3, {alpha: 1}));
            }
        }

        function LoadImages()
        {
                LoadLeft();
        }


function LoadLeft():void
        {
            if(start_flag ==
true)
            {
                container_left = new Sprite();
            } else {

big_container.removeChild(container_left);

container_left = container_left2;
            }

big_container.addChild(container_left)
            var path:String =
"images/left" + i + ".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,
LoadLeftLoaded);
        }

        function
LoadLeftLoaded(evt:Event):void
        {
            var
loaderInfo:LoaderInfo = evt.target as LoaderInfo;
            var
displayObject:DisplayObject = loaderInfo.content;

displayObject.width = 319;
            displayObject.height = 502;
            big_container.removeChild(container_left2);

container_left.addChild(displayObject);
            if(start_flag2 == true)
            {
                container_left.x = 1000;
                container_left.y = 20;
            } else {
                container_left.x = 30;
                container_left.y =
20;
            }
            var timeline:TimelineLite = new
TimelineLite({onComplete:SpinLeft});
            timeline.append(new
TweenLite(container_left, 1, {x:30, y:20}));
        }

        function SpinLeft()
        {

big_container.addChild(container_left2)
            var path:String = "images/left" + 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,
SpinLeftLoaded);
        }

        function
SpinLeftLoaded(evt:Event):void
        {
            var
loaderInfo:LoaderInfo = evt.target as LoaderInfo;
            var
displayObject:DisplayObject = loaderInfo.content;

displayObject.width = 319;
            displayObject.height = 502;
            container_left2.addChild(displayObject);

container_left2.x = 30;
            container_left2.y = -482;
            var rand:Number = new Number(randomNumber(rand_low, rand_high));
            var timeline:TimelineLite = new TimelineLite({onComplete:
CompleteLeft});
            timeline.append(new
TweenLite(container_left, rand/100, {alpha: 1}));

timeline.append(new TweenLite(container_left, 1, {x:30, y:522}));
            var timeline2:TimelineLite = new TimelineLite();
            timeline2.append(new TweenLite(container_left2, rand/100,
{alpha: 1}));
            timeline2.append(new TweenLite(container_left2, 1, {x:30,
y:20}));
        }

        function CompleteLeft()
        {
            left_done = true;
            AllDone();
        }

        function AllDone()
        {
            if(right_done == true&&  mid_done == true&&
left_done == true)
            {
                right_done =
false;
                mid_done = false;
                left_done = false;
                i += 1;
                j += 1;
                BigContainer()
            }
        }


TIA,
John





_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to