How do I refer to an instance from inside it's own code in Adobe Flash.

Posted by matt1024 on Stack Overflow See other posts from Stack Overflow or by matt1024
Published on 2010-05-16T01:40:07Z Indexed on 2010/05/16 1:50 UTC
Read the original article Hit count: 195

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about as3