Jump to content
Search Community

adding a function inside a tween [SOLVED]

orip test
Moderator Tag

Recommended Posts

Hi ppl,

 

I'm a bit of a newbe to tweenmax, Just got a bit confused with an attempt to combine a function inside a tween,

the code goes something like this: (i know it's wrong, just trying to figure out how to solve it)

 

 				TweenMax.to(anchorImages["masterImage"+(array)],0.5,{delay:0,blurFilter:{blurX:5, blurY:5}, _alpha:100,_x:570+26, _y:195-60, _xscale:30, _yscale:30, ease:Cubic.easeInOut, from here i want to activate the following FUNCTION(){
				imageRight.bt._visible = true;
				anchorImages["masterImage" + (array - 2)].bt._visible = true;
				anchorImages["masterImage" + (array - 1)].bt._visible = true;
				anchorImages["masterImage" + (array)].bt._visible = true;
				trace("working");
			});

 

how do I combine it properly without setting it apart to a different function (like when I use onComplete)?

 

Any help or a direction would be much appreciated,

 

Thanks!

Link to comment
Share on other sites

So you want that code in the function to run AFTER the tween completes, right? But you don't want to use a function? Well, you have two options that I can think of, one of which still uses a function:

 

1) Do a tween of the "_visible" property that is delayed and has an extremely short duration (even 0 is okay):

TweenMax.to(anchorImages["masterImage"+(array)],0.5,{delay:0,blurFilter:{blurX:5, blurY:5}, _alpha:100,_x:570+26, _y:195-60, _xscale:30, _yscale:30, ease:Cubic.easeInOut});
TweenMax.to(imageRight.bt, 0, {delay:0.5, _visible:true});
TweenMax.to(anchorImages["masterImage" + (array - 2)].bt, 0, {delay:0.5, _visible:true});
TweenMax.to(anchorImages["masterImage" + (array - 1)].bt, 0, {delay:0.5, _visible:true});
TweenMax.to(anchorImages["masterImage" + (array)].bt, 0, {delay:0.5, _visible:true});

 

- OR -

 

2)

TweenMax.to(anchorImages["masterImage"+(array)],0.5,{delay:0,blurFilter:{blurX:5, blurY:5}, _alpha:100,_x:570+26, _y:195-60, _xscale:30, _yscale:30, ease:Cubic.easeInOut, onComplete:onCompleteTween, onCompleteParams:[ anchorImages["masterImage" + (array - 2)].bt, anchorImages["masterImage" + (array - 1)].bt, anchorImages["masterImage" + (array)].bt]});

function onCompleteTween(mc1:MovieClip, mc2:MovieClip, mc3:MovieClip):Void {
   imageRight.bt._visible = true;
   mc1._visible = true;
   mc2._visible = true;
   mc3._visible = true;
   trace("working");
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...