1 Reply Latest reply on Jan 31, 2015 10:27 AM by oSunde

    addChild, setTimeout problem

    oSunde

      import flash.events.Event;

      import flash.utils.*;

      import flash.events.TimerEvent;

       

       

      //import flash.media.Sound;

      //import flash.net.URLRequest;

      import flash.display.Sprite;

       

       

      setTimeout(Blokk, 1000);

      setTimeout(Blokk1,3000);

       

       

      addEventListener(Event.ENTER_FRAME, eFrame);

        function eFrame(event:Event):void{

       

        x -= 5;

       

        }

       

       

      function Blokk():void{

        Kloss.x=800;

        Kloss.y=435;

       

       

        addChild(Kloss);

      }

       

       

       

       

      function Blokk1():void{

        Kloss1.x=800;

        Kloss1.y=435;

       

       

        addChild(Kloss1);

      }

       

       

      My problem is that when addChild(Kloss1); runs it adds Kloss1 in the same place as Kloss. It seems like the timer works, but it adds Kloss1 in the same place as where Kloss is.

      Another question I have is if it is possible to make only Kloss1 move. I tried adding the ceode inside the function. But both moved nevertheless.