Forums: Flash:

 

AS 2: Movieclip transition

first
 

ubik01 AS 2: Movieclip transition

I need to make a sort of navigation between different movieclips. The movies should have mxtransition when they come in the view, and mxtransitions when they go out. For example I have 2 buttons, first calls mc1, second mc2. Both mc has mxtransitions in and out. If I push button 1 mc1 comes with mxtransitions in. I want to tell somehow to mc2 to come in, after mc1 finished mxtransitions out.
I think is something about correlating onMotionFinished with another button action.
Actually it is 5 mc's but if I figure out the moves between 2 I can do the rest.
Something like this:

btn1 btn2 btn3

click on btn1 mc1 mxtransition in mc1
click on btn2 or btn3 - mc1 mxtransitions out, and after that, mxtransition in mc2 or mc3


I need some kind of continuity between movies (one out other in), here is an example - click on menus to see what I ment:

templatehelp.com/preset/p...70zoqi0mlpNLso

Excuse my bad english.

 

JLM

Sequences are simplier but I am not sure they will be supported in AS2 yet in tweenLite
blog.greensock.com/v11beta/

Another possible is asapLibrary which I have only used for AS3 but?
asaplibrary.org/api/html/

Although you may find Tweener easiest to use see here for relevant example
hosted.zeh.com.br/tweener/docs/en-us/ (select 'Tweening Parameters' and then 'onComplete' )

goASAP is another option and there is probably more I doubt that the mxtransitios route is the best but yes onMotionFinished should work fine, check tutorials at actionscript org




 

ubik01

10x for guiding, I'll try it ! I'm much on graphic design side than programing that's why It's not very important if code is as2 or as3. I really need a simple code example.

 

JLM

well the link I suggested at tweener should be helpful


// rough timeline code untested as2
// check the imports as I have them wrong, also download caurina package
import caurina.Tweener;
import flash.events.*;
import flash.display.*;
import Delegate;


var centreX: Number = 100;
var centreY: Number = 100;

var hideX: Number = -100;
var hideY: Number = -100;

var next_mc: MovieClip;

// add button functionality
for( i=1; i++; i=2)
{
// movies used as buttons named btn1_mc,...
['btn'+i+'_mc'].friend_mc = ['mc'+i+'_mc'];
['btn'+i+'_mc'].onRelease = Delegate.create( this, pressed );
['mc'+i+'_mc']._x = hideX;
['mc'+i+'_mc']._Y = hideY;
}

// set current movie on stage
var current_mc: MovieClip = mc1;
mc1._x = centreX;
mc1._y = centreY;

function pressed( e: MouseEvent ):void
{
next_mc = this.friend_mc;
Tweener.addTween( current_mc, {_x:hideX,_y:hideY, time:1, onComplete:bringNextIn });
}

function bringNextIn( e: MouseEvent ):void
{
Tweener.addTween( next_mc, {_x:centreX,_y:centreY, time:1 });
current_mc = next_mc;
}


Don't expect me to trouble shoot! Its more or less the right idea, done for designer types rather than coders its just to get you started, not done as2 for awhile so sorry for an errors.

 

JLM

not sure about this line will scope right
next_mc = this.friend_mc;
might be
next_mc = e.target.friend_mc;// or currentTarget.friend_mc;

 

ubik01

Its pretty complex what you coded there. My code is like this:

myButton_btn.onRelease = function() {
tweenmovie();
};
function tweenmovie() {
easeType = mx.transitions.easing.Bounce.easeOut;
var begin = 20;
var end = 380;
var time = .5;
var mc = ball_mc;
tweenmovie = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
}


So after I press btn1 the movie comes in. I just want when I press btn2, btn3 the sequence below should go reverse (the movie goes out from main scene) and the new movie enters with the same effects like the first.
Thanx

 

JLM

I may fix my code up later but I have given my answer. Good luck.

 

scudsucker

If, onPress, you tell all the other clips to tween to the "off" position; you will get the currently open one to "close". You will lose a little processing while flash works out that the tweens for all the "off" state clips do not actually have to be done, but it is negligable.

Assuming you name your clips ball1_mc, ball2_mc etc etc

Actionscript 1


myButton_1_btn.onRelease = function() {

tweenmovie(1);
};
myButton_2_btn.onRelease = function() {

tweenmovie(2);
};
function tweenmovie(mcNumber) {
easeType = mx.transitions.easing.Bounce.easeOut;
var begin = 20;
var end = 380;
var time = .5;

// we need to know how many clips to target
var numberOfMovieClips=5;

for(i=1; i<=numberOfMovieClips; i++) {
// set a reference to the clip...
var mc = this["ball" + i + "_mc"];

if(i==mcNumber) {

// move the required clip onstage - from "begin" to "end"
var t = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
} else {

// move all other clips to the "begin" state - from their current position
var t = new mx.transitions.Tween(mc, "_x", easeType, mc._x, begin, time, true);
}
}
}


__________________________
Hmbeh.
quote
 
first
 

Forums: Flash: AS 2: Movieclip transition

 
New Post
 
You must be logged in to post