How to use Tweens complete: onComplete

768 views
Skip to first unread message

primaerfunktion

unread,
Jan 31, 2014, 11:55:14 AM1/31/14
to haxef...@googlegroups.com


So I have this simple Tween:

FlxTween.multiVar(title, { y : FlxG.height / 2, alpha : 1 }, 10, { complete: ShowMenu} );

This is how the function looks like:

function ShowMenu():Void{
 
FlxG.camera.shake();
 subtitle
.alpha = 0.8;
}

These are the errors I'm getting:

source/MenuState.hx:42: characters 79-87 : Void -> Void should be Null<flixel.tweens.CompleteCallback>
source/MenuState.hx:42: characters 79-87 : Void -> Void should be flixel.tweens.CompleteCallback
source/MenuState.hx:42: characters 79-87 : Void -> Void should be flixel.tweens.FlxTween -> Void

How do I use this correctly? Sadly there's no example given in the Demo, so I think this should be added to it. I'm probably not the only one running into this issue. I hope so at least. :)

Gama11

unread,
Jan 31, 2014, 11:58:45 AM1/31/14
to
source/MenuState.hx:42: characters 79-87 : Void -> Void should be flixel.tweens.FlxTween -> Void

That error pretty much says it - the complete function you specfiy has the wrong type. Are you familiar with the function typing notation in haxe?

Your complete function should look like this / have the type FlxTween->Void (take a FlxTween and return nothing)

function ShowMenu(tween:FlxTween):Void{
 
FlxG.camera.shake();
 subtitle
.alpha = 0.8;
}


primaerfunktion

unread,
Jan 31, 2014, 12:03:53 PM1/31/14
to haxef...@googlegroups.com
Ah, I see. That actually explains a few issues I ran into recently too. Thanks.
Reply all
Reply to author
Forward
0 new messages