Just to make it sure, here's to complete code:
onClipEvent (load) {
//DEFINE EASING MOTION FUNCTION
_global.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) return c/2*t*t + b;
t--;
return -c/2 * (t*(t-2) - 1) + b;
};
//REFERENCES ALL MOVIE CLIPS TO BE CONTROLLED
var objects01:Array = new Array("logo", "logo", "logo", "logo", "logo");
var objects02:Array = new Array("quote01", "quote02", "quote03", "quote04", "quote05");
var objects03:Array = new Array("image01", "image02", "image03", "image04", "image05");
var objects04:Array = new Array("text01", "text02", "text03", "text04", "text05");
var gotoPos:Array = new Array(0, 250, 550, 750, 950);
//CREATE SEPARATE TIMERS
for(var i=0;i<5;i++)
this.createEmptyMovieClip(
//INVOKED WHEN MAIN NAV IS CLICKED, CYCLES THROUGH ARRAY AND MOVES ALL OBJECTS
_global.region = function(r){
t = 0;
for(var t=0;t<2;t++){
doMove(t,r);
// trace(t);
}
};
//DOES ALL OBJECTS MOTION A:LOGO B:QUOTE C:IMAGE D:TEXT & CONTENT
doMove = function(m,r){
var i=0;
var thePosA = eval("_parent." + objects01[m] + "._x");
var thePosB = eval("_parent." + objects02[m] + "._x");
var thePosC = eval("_parent." + objects03[m] + "._x");
var thePosD = eval("_parent." + objects04[m] + "._x");
var theDifA = gotoPos[r] - thePosA;
var theDifB = (gotoPos[r] * 3) - thePosB;
var theDifC = (gotoPos[r] * 6) - thePosC;
var theDifD = (gotoPos[r] * 9) - thePosD;
trace("m="+m + " r="+r);
eval("timer_"+m).onEnterFr
set("_parent." + objects01[m] + "._x" , easeInOutQuad(i,thePosA,th
set("_parent." + objects02[m] + "._x" , easeInOutQuad(i,thePosB,th
set("_parent." + objects03[m] + "._x" , easeInOutQuad(i,thePosC,th
set("_parent." + objects04[m] + "._x" , easeInOutQuad(i,thePosD,th
if (eval("_parent." + objects01[m] + "._x") == gotoPos[r]){
delete eval("timer_"+m).onEnterFr
var i=0;
// trace ("deleted");
} else {
i++;
}
//trace (eval("_parent." + objects02[0] + "._x") + "+" + eval("_parent." + objects02[1] + "._x"));
};
};
}
Main Topics
Browse All Topics





by: ivan_osPosted on 2006-03-06 at 09:58:54ID: 16116662
Hi,
"timer_"+i ,this.getN extHighest Depth());
ame = function(){ eDifA,50)) ; eDifB,50)) ; eDifC,50)) ; eDifD,50)) ; ame;
your problem here is that you're trying to use one onEnterFrame event to handle all movements -> which ends up exactly as you notified, that one onEnterFrame rewrites another and thus objects are not moving.
There's lot of ways how to solve this - you can use setInterval, separate onEnterFrame timers, even for loop would do the trick here.. but I decided to show you
one with onEnterFrame timers:
you have to declare five ( or as many as you will need) separate timers ( emptyMovieClips) somewhere in your actor.onClipEvent (load) function:
for(var i=0;i<5;i++)
this.createEmptyMovieClip(
and then in doMove use onEnterFrame of each timer for each set of objects:
doMove = function(m,r){
var i=0;
var thePosA = eval("_parent." + objects01[m] + "._x");
var thePosB = eval("_parent." + objects02[m] + "._x");
var thePosC = eval("_parent." + objects03[m] + "._x");
var thePosD = eval("_parent." + objects04[m] + "._x");
var theDifA = gotoPos[r] - thePosA;
var theDifB = (gotoPos[r] * 3) - thePosB;
var theDifC = (gotoPos[r] * 6) - thePosC;
var theDifD = (gotoPos[r] * 9) - thePosD;
trace("m="+m + " r="+r);
eval("timer_"+m).onEnterFr
set("_parent." + objects01[m] + "._x" , easeInOutQuad(i,thePosA,th
set("_parent." + objects02[m] + "._x" , easeInOutQuad(i,thePosB,th
set("_parent." + objects03[m] + "._x" , easeInOutQuad(i,thePosC,th
set("_parent." + objects04[m] + "._x" , easeInOutQuad(i,thePosD,th
if (eval("_parent." + objects01[m] + "._x") == gotoPos[r]){
delete eval("timer_"+m).onEnterFr
var i=0;
// trace ("deleted");
} else {
i++;
}
//trace (eval("_parent." + objects02[0] + "._x") + "+" + eval("_parent." + objects02[1] + "._x"));
};
If it will not work I'll upload you working fla :o)
Regards,
ivan_os