I’ve scripted a small flash file that for some reason, does not throw any errors but does not apply the tweens I have set for the beggining…
Please take a look at what I mean:
import gs.TweenLite;
import gs.easing.*;
var tabs:Array = new Array();
var btnProps:Array = new Array();
var prop:Rectangle;
for(var i:Number = 0; i < top_menu_buttons.numChildren; i++)
{
var _btn:MovieClip = MovieClip(top_menu_buttons.getChildAt(i));
_btn.buttonMode = true;
_btn.mouseChildren = false;
_btn.id = i;
_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
_btn.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
_btn.addEventListener(MouseEvent.CLICK, menuClick, false, 0, true);
tabs.push(_btn);
var _rect:Rectangle = new Rectangle(_btn.x, _btn.y, _btn.width, _btn.height);
btnProps.push(_rect);
}
tab_photo.addEventListener(MouseEvent.MOUSE_OVER, buttonOver, false, 0, true);
tab_photo.addEventListener(MouseEvent.MOUSE_OUT, buttonOut, false, 0, true);
tab_photo.addEventListener(MouseEvent.CLICK, buttonClick, false, 0, true);
TweenLite.from(photo, .2, {alpha:1});
TweenLite.from(tab_photo, .2, {alpha:1, delay:.2});
TweenLite.from(products_section, .2, {alpha:1, delay:.4});
TweenLite.from(tab_products, .2, {alpha:1, delay:.6});
TweenLite.from(services_section, .2, {alpha:1, delay:.8});
TweenLite.from(tab_services, .2, {alpha:1, delay:1});
TweenLite.from(environment_section, .2, {alpha:1, delay:1.2});
TweenLite.from(tab_environment, .2, {alpha:1, delay:1.4});
function onOver(e:MouseEvent):void
{
// prop contains the initial x,y,width,height properties of the targeted movieclip
prop = btnProps[e.target.id];
TweenLite.to(e.target, .2, {x:prop.x+10});
}
function onOut(e:MouseEvent):void
{
TweenLite.to(e.target, .2, {x:prop.x});
}
function menuClick(e:MouseEvent):void
{
switch(MovieClip(e.currentTarget).id)
{
case 0:
trace("1");
break;
case 1:
trace("2");
break;
case 2:
trace("3");
break;
case 3:
trace("4");
break;
case 4:
trace("5");
break;
case 5:
trace("6");
break;
case 6:
trace("7");
break;
}
}
function buttonOver(e:MouseEvent):void
{
TweenLite.to(e.target, .2, {x:x-10});
}
function buttonOut(e:MouseEvent):void
{
TweenLite.to(e.target, .2, {x:x});
}
function buttonClick(e:MouseEvent):void
{
TweenLite.to(top_menu_buttons, .2, {x:670});
TweenLite.to(top_menu_background, .2, {x:670});
}
All the tweens I have, that I’d like to play as the .swf begins, are not playing at all. Anyone have any idea why this is happening?