Trying to get this working in Flash AS3, AIR 3.2 for iOS, using GreenSock. I've tried defining it as a variable, function, etc, to no avail. A search online comes up with nothing.
The following errors come up for the line of code TweenMax tween = TweenMax.to(textOne, 14, {x:xScreenPosEnd, ease:SlowMo.ease.config(1, 0), repeat:-1});
:
1071: Syntax error: expected a definition keyword (such as function) after attribute TweenMax, not tween.
1084: Syntax error: expecting rightbrace before leftbrace.
1084: Syntax error: expecting identifier before rightparen.
var middle:Boolean = false;
public function run():void {
TweenMax tween = TweenMax.to(textOne, 14, {x:xScreenPosEnd, ease:SlowMo.ease.config(1, 0), repeat:-1});
tween.addEventListener(TweenEvent.UPDATE, updateListener);
tween.addEventListener(TweenEvent.REPEAT, repeatListener);
}
function updateListener(e:TweenEvent):void {
if(tween.currentProgress > 0.5 && middle == false)
{
TweenMax.to(textOne, 7, {ease:SlowMo.ease.config(1, 0), repeat:-1, autoAlpha:0});
middle = true;
}
}
function repeatListener(e:TweenEvent):void {
textOne.alpha = 1.0;
middle = false;
}
EDIT: The line in error has been replaced with var tween:TweenMax = TweenMax.to(textOne, 14, {x:xScreenPosEnd, ease:SlowMo.ease.config(1, 0), repeat:-1});
Further errors that come up are:
1120: Access of undefined property TweenMax.
1046: Type was not found or was not a compile-time constant: TweenMax.
1120: Access of undefined property tween.
1120: Access of undefined property middle.
My imports of GreenSock are as follows:
import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.greensock.events.TweenEvent;
Even tried import com.greensock.*;
EDIT: Adding the line import com.greensock.TweenMax;
has removed the errors:
1120: Access of undefined property TweenMax.
1046: Type was not found or was not a compile-time constant: TweenMax.
The other two errors still stands.
var tween=TweenMax.to(...)
You seemingly mixed up syntaxes for AS3 and Java or alike language. – Vesper