# Linking a movieclip that's on the stage to a class, don't want to use library linkage

**URL:** <https://forum.kirupa.com/t/linking-a-movieclip-thats-on-the-stage-to-a-class-dont-want-to-use-library-linkage/282664>\
**Category:** flash\
**Created:** [February 24, 2009, 10:22pm UTC](https://forum.kirupa.com/t/linking-a-movieclip-thats-on-the-stage-to-a-class-dont-want-to-use-library-linkage/282664 "2009-02-24T22:22:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DorkBot](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@DorkBot](https://forum.kirupa.com/u/DorkBot)\
**Post date:** [February 24, 2009, 10:22pm UTC](https://forum.kirupa.com/t/linking-a-movieclip-thats-on-the-stage-to-a-class-dont-want-to-use-library-linkage/282664/1 "2009-02-24T22:22:51Z")

</div>

Does anyone know if it’s possible to link a MovieClip on the stage to a class?

I have a MovieClip on the stage called: square\_mc

and I have this Move class (see attached code).

Of course when I set the class linkage of square\_mc to the Move class, square\_mc moves down the screen, Move is working. But how would I attach the Move class to square\_mc at runtime, when it’s on the stage?

Thanks!  
Attach Code

package {  
import flash.display.MovieClip;  
import flash.events.Event;  
//  
public class Move extends MovieClip {  
//  
public function Move () {  
trace (“Move”);  
this.addEventListener(Event.ENTER\_FRAME, moveSquare);  
}  
//  
private function moveSquare (event:Event) {  
this.y += 1;  
}  
}  
}
