How to access the stage from an AS3 class in Adobe Flash
        Posted  
        
            by Graphithy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Graphithy
        
        
        
        Published on 2010-04-21T20:36:05Z
        Indexed on 
            2010/04/21
            21:03 UTC
        
        
        Read the original article
        Hit count: 284
        
The problem I've encountered is that I am using a keyboardEventListener to make a movieclip run around. As I'm a college student, I'm creating this for an assignment but we are forced to use as3 classes.
When I run the code in the maintimeline, there is no problem. But when I try to access it from another class (with an 'Export for ActionScript' on the movieclip in question) I get an error he can't address the stage.
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, dostuff);
© Stack Overflow or respective owner