学习啦 > 学习电脑 > 电脑硬件知识 > 键盘鼠标 > flex鼠标双击事件怎么实现

flex鼠标双击事件怎么实现

时间: 沈迪豪908 分享

flex鼠标双击事件怎么实现

  学习前端的同学你们知道怎么你们知道什么是flex 鼠标双击事件吗?不知道的话跟着学习啦小编一起来学习了解flex 鼠标双击事件。

  flex 鼠标双击事件的代码

  <?xml version="1.0" encoding="utf-8"?>

  <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

  xmlns:s="library://ns.adobe.com/flex/spark"

  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

  <s:layout>

  <s:BasicLayout/>

  </s:layout>

  <fx:Script>

  <![CDATA[

  import flash.utils.getTimer;

  import mx.controls.Alert;

  private var delay:uint = 300;

  //前后两次的单击的时间

  private var firstClick:uint;

  private var lastClick:uint;

  protected function buttonId_mouseWheelHandler(event:MouseEvent):void

  {

  //buttonId.x = event.delta;

  if(firstClick == 0) {

  firstClick = getTimer();

  myText.text += "firstClick:"+firstClick+"\n";

  }else {

  lastClick = getTimer();

  myText.text += "lastClick:"+lastClick+"\n";

  if(lastClick-firstClick<delay) {

  myText.text += lastClick-firstClick+"\n";

  Alert.show("doubleClick");

  }

  firstClick = getTimer();

  }

  }

  ]]>

  </fx:Script>

  <fx:Declarations>

  <!-- 将非可视元素(例如服务、值对象)放在此处 -->

  </fx:Declarations>

  <!--<s:Button x="258" y="227" label="button" id="buttonId" mouseWheel="buttonId_mouseWheelHandler(event)"/>-->

  <s:TextArea id="myText" x="204" y="39"/>

  <s:Button x="258" y="227" label="button" id="buttonId" click="buttonId_mouseWheelHandler(event)"/>

  </s:Application>

鼠标双击事件相关文章:

1.java鼠标双击事件

2.怎么用JS实现鼠标单击与双击事件共存

3.如何设置鼠标事件

4.win7鼠标怎么设置单双击

5.鼠标事件属性详解

2006633