In Adobe Flash, I have a movie clip that is added to the stage when the keyboard is pressed. I want it to travel across the screen and disappear once it reaches the edge of the stage. At the moment I use this
but the image appears and then stops. Here is my code:
addEventListener(Event.ADDED_TO_STAGE,runtime);
var c = 0
function runtime(){
while(this.x<800){
this.x += 12;
}开发者_开发百科
removeChild(this);
}
Thanks
Unfortunately, it looks as though there is no override for the = operator and so the += 12 is just adding 12 to an integer, not actually redrawing the image. You will have to figure out how the image gets drawn and erased. Perhaps look for a bit blit routine.
Solved the problem :P
changed the first line to
addEventListener(Event.ENTER_FRAME,runtime);
and scrapped the while loop.
精彩评论