本文主要是介绍鼠标事件:MouseOut与RollOut,MouseOver与RollOver,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
http://hi.baidu.com/duancx/blog/item/b6cce83622a92645241f14e0.html :
下面是测试的代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
creationComplete="init()">
<mx:Script>
<![CDATA[
private function init():void{
cav.addEventListener(MouseEvent.ROLL_OVER,rollover);
cav.addEventListener(MouseEvent.ROLL_OUT,rollout);
cav.addEventListener(MouseEvent.MOUSE_OVER,mouseover);
cav.addEventListener(MouseEvent.MOUSE_OUT,mouseout);
}
private function rollover(event:MouseEvent):void{
trace("roll over");
}
private function rollout(event:MouseEvent):void{
trace("roll out");
}
private function mouseover(event:MouseEvent):void{
trace("mouse over");
}
private function mouseout(event:MouseEvent):void{
trace("mouse out");
}
]]>
</mx:Script>
<mx:Canvas id="cav" width="100%" height="100%"
borderStyle="solid" backgroundColor="0xFFFFFF">
<mx:Button id="b" label="here" x="64" y="47" width="107" height="54"/>
</mx:Canvas>
</mx:Application>
测试的结果如下:
移入Canvas:roll over
移入Canvas:mouse over
移入Canvas中的按钮:mouse out
移入Canvas中的按钮:mouse over
再次移入Canvas:mouse out
再次移入Canvas:mouse over
移出Canvas:mouse out
移出Canvas:roll out
这篇关于鼠标事件:MouseOut与RollOut,MouseOver与RollOver的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!