-
If statement and Tween
Hi,
I am trying to create an if statement to control whether or not a popup box slides in from offstage or is static. I am using an array to determine if it should, 1=yes, 0=no. The tween works fine all by itself, but as soon as I try to put it into a function, it breaks. What am I doing wrong? Is there a better way to control whether or not it slides in?
Code:
stage.addEventListener (Event.ENTER_FRAME, popSlide);
function popSlide (event:Event):void{
if (this.slideArray[(currentFrame-1)]==1){
//next line works by itself, but can't get it to work with the IF statement
var myTween=new Tween(this.PopUp_mc,"y", Strong.easeOut, 500, 300, 1, true);
}else{
this.PopUp_mc.x=50;
this.PopUp_mc.y=50;
}
}
Thanks!
-
I got the tween to work by initiating it outside the function, and then just calling it. However, I can't get it to re-initilize after the first time. The function seems to be working, but the tween itself does not.
Code:
var slideTween=new Tween(this.PopUp_mc,"y",Strong.easeOut,800,400,1,true);
stage.addEventListener (Event.ENTER_FRAME, popSlide);
function popSlide(event:Event):void{
if (slideArray[(currentFrame-1)]=="yes"){
slideTween;
trace("slide");
}else{
this.PopUp_mc.y=400;
trace("static");
}
}
-
Dignitary
-
no, I am just using flash as3, nothing external. I have never used anyhing outside of flash's own code and am not familiar with how to do that.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|