You are here: Home > Programming > Flash programming > onEnterFrame for objects

onEnterFrame for objects

Print versionEdit this page
Original sourceexternal link

This is a method that uses OnEnterFrameBeacon:

// in the transitions package?  I think I would've put this in a util package...
import mx.transitions.OnEnterFrameBeacon;

// start the beacon, so we can listen for onEnterFrame 
OnEnterFrameBeacon.init();

var o:Object = new Object();
o.onEnterFrame = function() {
        trace("onEnterFrame outside of a MovieClip.. woohoo!");
}
// add the object as a MovieClip listener
MovieClip.addListener(o);
// you can also remove the listener as needed
// MovieClip.removeListener(o);