よくあるバグを言語ごとに系統的にまとめたようなのないかね。
DisplayObjectにエフェクトを登録したいとです。MXMLならすぐ分かりました。
Canvasをマウスオーバーでズームする例。
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Zoom id="zoom" duration="1000" zoomHeightTo="2" zoomWidthTo="2" />
<mx:Canvas width="100" height="100" backgroundColor="blue" rollOverEffect="{zoom}">
</mx:Canvas>
</mx:Application>
ActionScriptからはどうするのか。
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
public function init():void {
this.canvas1.setStyle("rollOverEffect", "zoom");
}
]]>
</mx:Script>
<mx:Zoom id="zoom" duration="1000" zoomHeightTo="2" zoomWidthTo="2" />
<mx:Canvas id="canvas1" width="100" height="100" backgroundColor="blue" creationComplete="init()">
</mx:Canvas>
</mx:Application>
まさかsetStyleとは。
あとは
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.effects.Zoom;
public function rollOverHandler(event:MouseEvent):void {
var zoom:Zoom = new Zoom(event.target);
zoom.duration = 1000;
zoom.zoomHeightTo = 2;
zoom.zoomWidthTo = 2;
zoom.play();
}
]]>
</mx:Script>
<mx:Canvas id="canvas1" width="100" height="100" backgroundColor="blue" rollOver="rollOverHandler(event)">
</mx:Canvas>
</mx:Application>
以上
The truth just shines thugroh your post
Yup, that’ll do it. You have my appreciation.