DoubleClickDemo.mxml
<?xml version="1.0" encoding="utf-8"?>
<!--
/////////////////////////////////////////////////////////////////////////////////////////
// Application to demonstrate a possible implementation ' double click '
in Flex v 1.5
// Author : Vishwajit Girdhari
// Date : 14-Mar-2006
// Flex Blog : http://flexiness.blogspot.com
// Blog : http://vishwajit.blogspot.com
// Website : www.vishwajit.com
// email : vishwajit @ gmail.com
/////////////////////////////////////////////////////////////////////////////////////////
-->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script source="DoubleClickDemo_script.as" >
</mx:Script>
<mx:Panel>
<mx:Button id ="btnTest" label="Test single /
double click" click="button_clicked()" ></mx:Button>
</mx:Panel>
</mx:Application>
<!--
/////////////////////////////////////////////////////////////////////////////////////////
// Application to demonstrate a possible implementation ' double click '
in Flex v 1.5
// Author : Vishwajit Girdhari
// Date : 14-Mar-2006
// Flex Blog : http://flexiness.blogspot.com
// Blog : http://vishwajit.blogspot.com
// Website : www.vishwajit.com
// email : vishwajit @ gmail.com
/////////////////////////////////////////////////////////////////////////////////////////
-->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script source="DoubleClickDemo_script.as" >
</mx:Script>
<mx:Panel>
<mx:Button id ="btnTest" label="Test single /
double click" click="button_clicked()" ></mx:Button>
</mx:Panel>
</mx:Application>
DoubleClickDemo_script.as
/////////////////////////////////////////////////////////////////////////////////////////
// Application to demonstrate a possible implementation ' double click ' in Flex v 1.5
// Author : Vishwajit Girdhari
// Date : 14-Mar-2006
// Flex Blog : http://flexiness.blogspot.com
// Website : www.vishwajit.com
// email : vishwajit @ gmail.com
/////////////////////////////////////////////////////////////////////////////////////////
//Define the time duration to identify a double click.
var duration = 300;
var timer ;
//Called when the mouse button is clicked
function button_clicked()
{
// double click happened
if(timer != null)
{
// Call a specialised event for double click here.
mx.controls.Alert.show("Double click!");
//clean up
clearInterval(timer);
timer = null;
}
else
{
//start timer on first click
// setInterval obj,callback function,time interval
timer = setInterval(this,"click",duration);
}
}
// handles single clicks
function click(){
// Call a specialised event for single click here.
mx.controls.Alert.show("Single click!");
//clean up
clearInterval(timer);
timer = null;
}
1 comment:
Nice post and this mail helped me alot in my college assignement. Thanks you seeking your information.
Post a Comment