Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

addChild, setTimeout problem

$
0
0

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.


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>