|
-
Timer function
Hi
I have created a timer event,
and I want its function onTimerp3 to call the function
'Rollp3part2' into action, but I dont know how to initiate it:
Any help will be a great help!
matt
function onTimerp3 ( e : TimerEvent ) : void {
Rollp3part2
}
function Rollp3part2 ( e : MouseEvent ) {
myTween = new Tween ( e.target, "x" , Back.easeIn, e.target.x, p3part2RollPoint.x , 1 , true );
myTween = new Tween ( e.target, 'y' , Back.easeOut, e.target.y, p3part2RollPoint.y , 1 , true );
}
-
Since the second function is a mouse handler it's expecting a mouse event - override that with a default value so you can call it regularly:
function Rollp3part2 ( e : MouseEvent = null ) {
-
brilliant
Is this a correct way to call the second function 'Rollp3part2' ?
It is giving me an error report
function onTimerp3 ( e : TimerEvent ) : void {
Rollp3part2
}
thanks for the help
-
PHP Code:
function onTimerp3 (e:TimerEvent):void{
Rollp3part2();
}
-
hi neznein
thanks for the help so far!
however i am getting this message
'Cannot access a property or method of a null object reference'
Im having difficulty finding the problem
here is my code:
function onTimerp3 ( e : TimerEvent ) : void {
Rollp3part2();
}
function Rollp3part2 ( e : MouseEvent = null ) {
myTween = new Tween ( e.target, "x" , Back.easeIn, e.target.x, p3part2RollPoint.x , 1 , true );
myTween = new Tween ( e.target, 'y' , Back.easeOut, e.target.y, p3part2RollPoint.y , 1 , true );
}
cheers for helping
-
Oh whoops - your second function is using data from the mouse Event - so if you ignore that (eg. call that function from a timer) there is no mouse data for it to tween to.
You can either remove or rework those tweens or else you need to spoof a mouse event for whichever button you want to appear 'clicked' when that timer goes off...
-
Ah.. the tween that I want is to move an object to another position on the stage,, any suggestions how I could spoof a mouse event to do this?
-
If you already know the object you can do it like so:
PHP Code:
function onTimerp3 (e:TimerEvent):void{
// Rollp3part2();
theObject.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
-
Brilliant ! cheers neznein
that sorted out my problem
matt
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
|