2006/04/20 | BroadcasterMX与OnEnterFrameBeacon的使用,也可参考Tween类里的使用方法
类别(网摘) | 评论(0) | 阅读(80) | 发表于 03:52
摘自: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);

 

 

0

评论Comments

日志分类
首页[28]
flash[3]
javascript[3]
C#[1]
feeling[5]
网摘[16]