Hey! This may look like a long post but you may not have to read throught the whole thing…
I have created a textfield within a loop and put it in a sprite called textHolder. I loaded images in the same loop and put them in a container called imageHolder. The containers are assigned to the buttons button created by the loop. This works all great. But the thing that I am having trouble with is being able to tweenMax one of the holders. for example: I have a tweenMax that scales b1 (the first buttons created from the loop) by 3x. But I also need the text to fade out without the image fading out. So I tried just putting a tween on textHolder but nothin’ happens!
Maybe there is some rule here that I am missing that says I cant do that? If not, I dont know what I am doing wrong. here is some of my code:
public function placePictures():void {
var ba:Array = new Array();
ba.push(b1,b2,b3,b4,b5);
for(var i:uint=0;i<ba.length;i++) {
trace(name + ba*);
ba*.name = i;
imageLoader = new Loader();
imageLoader.load(new URLRequest(menuImageArrayURL.shift()));
imageLoader.x = 0;
imageLoader.y = 0;
textfield = new TextField();
textfield.text = menuTitleArray.shift();
textfield.setTextFormat(txtFmt);
textfield.selectable = false;
textfield.antiAliasType = AntiAliasType.ADVANCED;
textfield.embedFonts = true;
textfield.wordWrap = true;
textfield.width = 182;
textHolder = new Sprite();
textHolder.addChild(textfield);
textHolder.x = 0;
textHolder.y = 215;
imageHolder = new MovieClip();
imageHolder.addChild(imageLoader);
imageHolder.x = 0;
imageHolder.y = 0;
imageHolder.scaleX = 0.359551;
imageHolder.scaleY = 0.359551;
ba*.x = 0 + i * 250;
ba*.y = 0;
ba*.addChild(textHolder);
ba*.addChild(imageHolder);
ba*.buttonMode=true;
}
addButtonsToHolder();
}
//there is code here i took out to make it shorter for this post.
public function onButtonClick(e:Event):void {
var namesArray:Array = ["b1","b2","b3","b4","b5"];
var buttonWanted:String = namesArray[Number(e.currentTarget.name)];
switch (buttonWanted) {
case "b1" :
trace("TO BEVERAGES");
TweenMax.to(b1, 1, {x:340, y:-139, scaleX:2.78, scaleY:2.78, ease:Quad.easeInOut});
TweenMax.to(textHolder, 1, {alpha: 0, ease:Quad.easeInOut});
loadBeverages();
break;
//... and more code with is not pertinent
Do you know what i got wrong here?
Tks for any assistance