摘自:http://www.darronschall.com/weblog/archives/000082.cfm
// 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);
******************************************************************************************
import mx.transitions.BroadcasterMX;
obj = new Object();
// initialize the obj that will be broadcasting events
BroadcasterMX.initialize(obj);
// create a listener to respond to broadcasted events
listenObj = new Object();
listenObj.onMessage = function (param1, param2) {
trace("got onMessage " + arguments);
}
obj.addListener(listenObj);
obj.broadcastMessage("onMessage", "test param1", "test param2");
// you can also remove the listener:
// obj.removeListener(listenObj);
回复Comments
作者:
{commentrecontent}