Hi guys, I've been having some trouble with tweens. Here's a description of my usage:
I have a system where a textbox is the child of a movieclip. When you click the "Next" button, the movieclip fades to 0-alpha and upon completion, the text in the textbox is changed (to the next index in an array) and it tweens back in to 100-alpha. This makes a nice transition through the text.
My issue is that sometimes it doesn't tween back in, only out, leaving the user with an empty box where text should be.
However, I'd asked this question previously with the thought that it was "Timing out". Now, after significant testing I realised that it only happens if I click or select some of the text on the text box. Could it have something to do with this text selection intefering with the changeText function below... (it's the same text box, just the text changes).
Has anyone else experienced similar faults?
CODE:
function changeClick(e:MouseEvent):void {
if (e.currentTarget==btnRight) {
newDirect="right";
} else {
newDirect="left";
}
if (newDirect=="right") {
if (pageTotal!=pageCurrent) {
tweenText=new Tween(b_textB,"alpha",Strong.easeOut,1,0,.5,true);
tweenText.addEventListener(TweenEvent.MOTION_FINISH, changeText);
}
} else {
if (pageCurrent!=1) {
tweenText=new Tween(b_textB,"alpha",Strong.easeOut,1,0,.5,true);
tweenText.addEventListener(TweenEvent.MOTION_FINISH, changeText);
}
}
}
function changeText(e:TweenEvent):void {
var newText:String;
var pageCurrentConstant:int=pageCurrent;
if (newDirect=="right") {
for (var i=0; i<=(pageTotal-1); i++) {
if ((pageCurrentConstant-1)==i) {
if (i!=pageTotal-1) {
newText=pageText[i+1];
pageCurrent++;
} else {
newText=pageText[i];
}
}
}
} else {
for (var j=0; j<=pageTotal; j++) {
if (pageCurrentConstant==j) {
if (j!=0) {
newText=pageText[j-2];
pageCurrent--;
} else {
newText=pageText[j];
}
}
}
}
b_textB.htmlText=newText;
tweenText=new Tween(b_textB,"alpha",Strong.easeOut,0,1,.5,true);
drawWidget();
}
changeClick is initiated by either btnRight or btnLeft to navigate through the text