-
How to Pass a Timer Value Generated in a Function Value to an EventListener
Hello,
How do I pass a value generated in a Function to a Mouse Event?
I'm trying to pass the timer value to a function (see AS3 below.)
mymc.addEventListener(MouseEvent.MOUSE_DOWN, fMDWN);
function fMDWN(e:MouseEvent):void
{
//dosometning > can I capture the timer value here???
}
function ftimer():void{
var vstep2:Timer = new Timer(1000,20);
vstep2.addEventListener(TimerEvent.TIMER, vcount2);
function vcount2(e:TimerEvent):void{
//trace("@TMER====================================== ======== " + vcount2);//displays count
}
vstep2.start();
}
Any help would be greatly appreciated.
Thanks
-
.
Hi,
Does this help at all
PHP Code:
import flash.utils.Timer;
import flash.events.TimerEvent;
function ftimer():void
{
mymc.addEventListener(MouseEvent.MOUSE_DOWN, fMDWN);
var vstep2:Timer = new Timer(1000,20);
vstep2.addEventListener(TimerEvent.TIMER, vcount2);
function vcount2(e:TimerEvent):void
{
trace(String(vstep2.currentCount + " This is the timer."));
}
function fMDWN(e:MouseEvent):void
{
trace(String(vstep2.currentCount + " This is the clicked time."));
}
vstep2.start();
}
ftimer();
-
Hello Fruitbeard,
Thanks for your reply. Been in back to back meetings past few days.
That code definitely works. Now here's my followup question:
Can we pass this timer value out of our current function into another?
In old AS2 I could pass values from function to function via the parentheses.
If not, I think I can use this format.
Thanks again for your response.
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
|