Jump to content
Search Community

Timeline Lite & AS2

scottjan9119 test
Moderator Tag

Recommended Posts

Can someone help me out?

I was teaching myself how to use to use Timeline Lite by using it in a banner project. I am not an actionscript guy, so I used many of AS3 code hints and tutorials that were provided. Come to find out AS3 is not accepted. Can someone help me to make this AS2 friendly?

 

import com.greensock.*;
import com.greensock.easing.*;

var timeline:TimelineLite = new TimelineLite();

button.addEventListener(MouseEvent.CLICK, onMouseClick);

function onMouseClick(e:MouseEvent):void {
var request:URLRequest = new URLRequest("http://www.netscout.com/Pages/default.aspx");
navigateToURL(request, "_blank");
}

timeline.addLabel("begin", 1.5);

replay.addEventListener (MouseEvent.MOUSE_DOWN, overHandler);


function overHandler (event:MouseEvent):void {
   timeline.gotoAndPlay("begin");
}




timeline.appendMultiple([new TweenLite(logo, 1, {scaleX:100, scaleY:100, x:"-250"}),
new TweenLite(box4, .1, {alpha:0}),
new TweenLite(box5, .1, {alpha:0}),                                                                       
/*new TweenLite(logo, .75, {x:"800", scaleX:100, scaleY:100}),*/
new TweenLite(box1, 1, {alpha:1, scaleX:15, scaleY:15}),
new TweenLite(box2, 1, {alpha:1, scaleX:15, scaleY:15}),
new TweenLite(box3, 1, {alpha:1, scaleX:15, scaleY:15}),
new TweenLite(USDM, .5, {alpha:1, scaleX:.75, scaleY:.75}),
], 2, TweenAlign.START, 0.2);



timeline.appendMultiple([new TweenLite(sq1, .25, {y:45.50}),
new TweenLite(sq1, .75, {scaleX:60}),
new TweenLite(optimize, .25, {x:"270"}),
new TweenLite(sde, .25, {x:"-465.85"}),
], 1, TweenAlign.START, 0.2);







timeline.appendMultiple([new TweenLite(optimize, 1, {rotation:-90, scaleX:55, scaleY:55, y:282, x:-500}),
new TweenLite(sq2, .5, {scaleX:110}),
new TweenLite(protect, .25, {x:260}),
new TweenLite(protect2, .25, {y:50}),
new TweenLite(USDM, .1, {alpha:0}),
], 2, TweenAlign.START, 0.2);


timeline.appendMultiple([new TweenLite(optimize, .1, {alpha:0}),
new TweenLite(sq1, .1, {alpha:0}),
new TweenLite(optimize, .1, {alpha:0}),
new TweenLite(sde, .1, {alpha:0}),
], .1, TweenAlign.START, 0.2);




timeline.appendMultiple([new TweenLite(simplify, .25, {y:"90"}),
new TweenLite(simplify2, .1, {x:"345"}),
new TweenLite(operations, .1, {x:"-385"}),

], 2, TweenAlign.START, 0.2);



timeline.appendMultiple([new TweenLite(optimize, .1, {alpha:0}),
new TweenLite(sq2, .1, {alpha:0}),
new TweenLite(protect, .1, {alpha:0}),
new TweenLite(protect2, .1, {alpha:0}),
], .1, TweenAlign.START, 0);

/*timeline.appendMultiple([new TweenLite(simplify2, .5, {scaleX:30, scaleY:30}),
new TweenLite(operations, .5, {scaleX:100, scaleY:100}),
], 2, TweenAlign.START, 0.2);*/

timeline.appendMultiple([new TweenLite(simplify2, .5, {scaleX:200, scaleY:200}),
new TweenLite(operations, .25, {scaleX:450, scaleY:450, x:"-225"}),    
new TweenLite(simplify2, .1, {alpha:0}),
], 1.5, TweenAlign.START, 0.2);

timeline.appendMultiple([new TweenLite(banner, .5, {y:"-92"}),
new TweenLite(text, .25, {x:"320"}),
new TweenLite(button, .5, {y:"-40"}),
new TweenLite(pic, .5, {alpha:1}),
new TweenLite(ntsct, .5, {alpha:1}),
new TweenLite(replay, .5, {alpha:1}),
], .1, TweenAlign.START, 0.2);  

 

Thanks in advance for your help!

PS this is an awesome tweening tool

Link to comment
Share on other sites

In the interactive demos, you can click the "AS2" toggle switch to see the AS2 code instead of AS3. There are several things that are different in the core language, although TweenLite's overall syntax is the same:

 

- scaleX and scaleY are _xscale and _yscale and instead of going from 0-1, they go from 0-100.

- x and y are _x and _y

- rotation is _rotation

- width and height are _width and _height

- Instead of adding event listeners, you must use the built-in callbacks. For example:

 

//AS3:
button.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
function rollOverHandler(event:Event):void {
   //do stuff
}

//AS2:
button.onRollOver = function():Void {
   //do stuff
}

 

You should probably do some Google searching and/or read Adobe's "migrating from AS2 to AS3" material. Explaining all the differences between AS2 and AS3 are beyond the scope of this forum, but hopefully the hints above will get you through the immediate need.

Link to comment
Share on other sites

  • 1 year later...

Hi,

I had same problem -> Unexpected "]"

you HAVE TO remove in all line ( , ) in front of ( ] )

 

 

new TweenLite(USDM, .5, {alpha:1, scaleX:.75, scaleY:.75}),

], 2, TweenAlign.START, 0.2);

 

it must be like this

new TweenLite(USDM, .5, {alpha:1, scaleX:.75, scaleY:.75})

], 2, TweenAlign.START, 0.2);

 

Hope it will be working :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...