清风的blog 优然探索

以不同的坐标系统跟踪鼠标位置

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
<![CDATA[
private function traceMousePosition(event:MouseEvent):void{
 trace(" MouseEvent local position "+event.localX+"  "+event.localY);
 trace(" MousePosition stage position "+event.stageX+"  "+event.stageY);
 trace(" MouseEvent position from w/in component "+this.mouseX+"  "+this.mouseY);
 trace(" Content Mouse Position "+this.contentMouseX+"  "+this.contentMouseY);
}
]]>
</mx:Script>

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="500" paddingTop="10" paddingLeft="10" verticalGap="15" click="traceMousePosition(event)" x="96" y="87">
 <mx:Image source="@Embed('assets/01.jpg')"/>
 <mx:Image source="@Embed('assets/02.jpg')"/>
 <mx:Image source="@Embed('assets/03.jpg')"/>
 <mx:Image source="@Embed('assets/04.jpg')"/>
</mx:VBox>

</mx:Application>

 

2010年2月19日 | 发布:admin | 分类:Flex | 评论:0

发表留言: