Reputation: 79
I have a loop animation that stops and gives me an argument error. I've redone the coding a couple of different ways but to no avail. Here is my code:
contactbox.addEventListener(MouseEvent.MOUSE_OVER, Scroll);
function Scroll(evt:MouseEvent){
TweenLite.to(
btnwave, 2, {
x:-115.5, ease:Linear.easeNone, overwrite:true, onComplete:Switch});
}
function Switch(){
TweenLite.to(
btnwave, 0, {
x:184.6, ease:Linear.easeNone, overwrite:true, onComplete:Scroll});
}
And here is the error it gives me:
ArgumentError: Error #1063: Argument count mismatch on Main/Scroll(). Expected 1, got 0.
at Function/http://adobe.com/AS3/2006/builtin::apply()
at com.greensock.core::TweenCore/complete()
at com.greensock::TweenLite/renderTime()
at com.greensock::TweenLite()
at com.greensock::TweenLite$/to()
at Main/Switch()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at com.greensock.core::TweenCore/complete()
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()
I'm trying to brush up on my tweenlite skills for some upcoming work. Any help would be appreciated.
Upvotes: 1
Views: 151
Reputation: 10235
You're getting an error because TweenLite isn't passing a MouseEvent instance to Scroll(). Scroll() currently requires that a MouseEvent Object be passed to it since it's an event handler. You can fix this by making Scrolls first argument optional like this:
function Scroll(evt:MouseEvent=null){
This way, when TweenLite calls Scroll() the MouseEvent will just default to null.
Upvotes: 4