Hey GS... I am getting some weird behavior when creating array's of TimelineMax... I am iterating through a loop where I am defining main menu items, and submenu items... submenu holders etc... way too much code to bother you with, but the problem is, it seems like my TimelineMax instances are getting overwritten. I am using a container TimelineMax to do the work.
Inside my for loop, this is where I am assigning the TimelineMax instance to a data property of my button class...
var sub:Object = new Object();
sub = MASTER[i]['BUTTON_SET'][0]['L1_HOLDER'];
MASTER[i]['MAIN_BUTTON'].data.submenu_ref = sub;
MASTER[i]['MAIN_BUTTON'].addEventListener(buttonEvent.BUTTON_CLICK, handleDown);
MASTER[i]['MAIN_BUTTON'].addEventListener(buttonEvent.BUTTON_OVER, handleOverLevelOne);
MASTER[i]['MAIN_BUTTON'].addEventListener(buttonEvent.BUTTON_OUT, handleOutLevelOne);
var ro1:Object = returnLevelOneObject(MASTER[i]['MAIN_BUTTON']);
MASTER[i]['MAIN_BUTTON'].data.TEXT_TINT = ro1.TEXT_TINT;
MASTER[i]['MAIN_BUTTON'].data.TEXT_TINT_ALPHA = ro1.TEXT_TINT_ALPHA;
MASTER[i]['MAIN_BUTTON'].data.OVER_BLUR = ro1.OVER_BLUR;
MASTER[i]['MAIN_BUTTON'].data.BG_TINT = ro1.BG_TINT;
MASTER[i]['MAIN_BUTTON'].data.BG_TINT_ALPHA = ro1.BG_TINT_ALPHA;
MASTER[i]['MAIN_BUTTON'].data.TWEEN_WIDTH = ro1.TWEEN_WIDTH;
var MTL:TimelineMax = new TimelineMax({paused:true});
var MASTER_TL:TimelineMax;
MTL.append(TweenMax.to(MASTER[i]['MAIN_BUTTON'].button_bg, .25,{alpha:1, width:ro1.TWEEN_WIDTH + ro1.OVER_BLUR,blurFilter:{blurX:ro1.OVER_BLUR,blurY:ro1.OVER_BLUR},colorTransform:{tint:ro1.BG_TINT, tintAmount:ro1.BG_TINT_ALPHA}}));
MTL.append(TweenMax.to(MASTER[i]['MAIN_BUTTON'].text_holder, .25,{alpha:1,colorTransform:{tint:ro1.TEXT_TINT, tintAmount:ro1.TEXT_TINT_ALPHA}}) );
MTL.append(TweenMax.to(sub.submenu_holder,.25,{alpha:1,
onStart:function()
{
sub.submenu_holder.visible = true;
////// a bunch of code in this function, pointless to show
}
/// of course timelines is an array defined in the class file.
timelines.push({MASTER:MASTER_TL,MAIN:MTL});
ok, so when I hit my button over function
private function handleOverLevelOne(e:buttonEvent):void
{
if(e.currentTarget != cb)
{
cb = e.currentTarget;
if (e.data.timeline['MASTER'] != null) { e.data.timeline['MASTER'].kill(); }
var o:Object = e.data.submenu_ref;
mmh.expandMaskWidth(500);
mmh.removeEventListener('out',resetTheMenuPosition);
TweenMax.delayedCall(.25,preCheck);
function preCheck():void
{
if(e.data.over_button)
{
if(mmh.needs_scroller)
{
mmh.expandMaskWidth(500);
mmh.scroller.killTween();
}
sm.setActiveLevelOneButton(e.currentTarget);
e.data.timeline['MASTER'] = new TimelineMax();
e.data.timeline['MASTER'].append( e.data.timeline['MAIN'].tweenTo( e.data.timeline['MAIN'].duration ) );
}
}
}
}
but the funny thing is the submenu that shows up is the last ( sub ) object that I created... like it is getting overwritten on every loop. Do you have any ideas why this would happen?
Thanks.
Ryan