作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
大家好,我想知道 AS3 中的 dispatchEvent 是什么。
谷歌搜索时没有任何想法。 :(
所以请帮帮我
编辑1:
public static const SET_VOLUME:String = "setVolume";
private function onclick(evt:MouseEvent):void {
soundClip.scaleX = 0;
dispatchEvent(new Event(SET_VOLUME));
}
最佳答案
一个例子可能有帮助吗?如果您具有Flash IDE,请在时间轴中尝试以下操作:
var ball:Shape = new Shape();
ball.graphics.beginFill(0xFF0000);
ball.graphics.drawCircle(0, 0, 30);
ball.graphics.endFill();
addChild(ball);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveListener);
addEventListener("myCustomEvent", myCustomEventListener);
function mouseMoveListener(event:MouseEvent):void
{
dispatchEvent(new Event("myCustomEvent"));
}
function myCustomEventListener(event:Event):void
{
ball.x = stage.mouseX;
ball.y = stage.mouseY;
}
关于flash - Flash AS3中的dispatchEvent是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1855908/
我是一名优秀的程序员,十分优秀!