-
Double-click in ActionScript 1
I must create a mini-app consisting in a visual effect deployed on an image. Events are :
-- app shows the background image
-- visual effect starts on double-click (same-background + animation)
-- visual effect stops on double-click
-- app shows the background image again (no visual effect).
The client provided the FLA of the effect. It was done in ActionScript 1. Personally, I’m working with ActionScript 3 (CCS3, 4, 5).
Adapting the effect was OK, but adding the double-click created a problem : the visual effect simply stopped working.
I greatly need your help. I don’t know how to introduce the double-click (effect ON/OFF).
My deadline is almost here and I battle (without success) with this double-click since already four days.
Please, help a beginner !
-
.
Hi,
It's AS2 but it might help you figure it out
PHP Code:
var clickSpeed:Number = 250;// milliseconds
var mouseClick:Object = new Object();
mouseClick.onMouseDown = function(e:Object)
{
this.lastClicked = this.now;
this.now = getTimer();
if (this.now - this.lastClicked < clickSpeed)
{
button._visible = !button._visible;
trace("Double clicked");
}
};
Mouse.addListener(mouseClick);
-
.
Hi,
Forgot to say, AS3 has its own double click event.
PHP Code:
thing.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
-
Thank you
Originally Posted by fruitbeard
Hi,
It's AS2 but it might help you figure it out
PHP Code:
var clickSpeed:Number = 250;// milliseconds
var mouseClick:Object = new Object();
mouseClick.onMouseDown = function(e:Object)
{
this.lastClicked = this.now;
this.now = getTimer();
if (this.now - this.lastClicked < clickSpeed)
{
button._visible = !button._visible;
trace("Double clicked");
}
};
Mouse.addListener(mouseClick);
You helped me enormous. Everything is OK now.
Thank you again (thousand times) !
Ciberina
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|