The code is below. When Tweenlite is called it treats "tileList[count1]" as a string instead of a variable name. However the trace seems to return what I would expect (tile1, tile2, tile3...). If I remove "tileList[count1]" from the tween and replace it with a direct call to the MovieClip (tile1, tile2, etc) the code works perfectly...
Things I've tried:
Using a vector instead of an array.
Setting tileList[count1] to a public and local variable and then calling that variable.
Removing the randomSort.
Removing count1 and calling the array element directly (ie, tileList[5]).
public class wtpMain extends MovieClip {
public var tileList:Array = new Array(tile1,tile2,tile3,tile4,tile5,tile6,tile7,tile8,tile9,tile10,tile11,tile12,tile13,tile14,tile15 ,tile16);
public var count1:int = 0;
public function wtpMain() {
nextButton.buttonMode = true;
nextDis.mouseEnabled=false;
nextButton.addEventListener(MouseEvent.CLICK, nextButtonClickh);
tileList.sort(randomSort);
}
public function nextButtonClickh(event:MouseEvent):void {
nextButtonClick();
}
public function nextButtonClick():void{
TweenLite.to(tileList[count1], 5, {y:700, alpha:0});
trace(tileList[count1]);
count1++;
}
public function randomSort(objA:Object, objB:Object):int{
return Math.round(Math.random() * 2) - 1;
}
}
}