Detecting the last "onMotionFinished" during loop

let say i have an array (arr) that has references to 6 txt fields. I have a function like this:



function loopFadeAndCallFunction():Void {
    for (var i:Number = 0; i<arr.length; i++) {
        var txtTween:Tween = new Tween(arr*, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 0.5, true);
        txtTween.onMotionFinished = function() {
            doSomeFunction(); // but i only want this to be called on the sixth txtTween's ".onMotionFinished"
        };
    }
}


as commented, i only want the function “doSomeFunction” to execute on the final, sixth txtTween.onMotionFinished.

any ideas?

function loopFadeAndCallFunction():Void {
 for (var i:Number = 0; i < arr.length; i++) {
  var txtTween:Tween = new Tween(arr*, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 0.5, true);
 }
 txtTween.onMotionFinished = function() {
  doSomeFunction();
 };
}

Thanks for the reply Mr. Redleaf :slight_smile:

I have to apologize as I don’t think my attempt at a simplified version of my script was adequate in explaining my problem. I pulled the following function out of my project and took out as much non-relevant stuff as i could.

The problem im haveing is that the user is able to click and activate my .onRelease function before all of the menu text has been created. This results in the possibility of text fields not being removed/hidden when the next animation begins, because they do not yet exist before the scipt that removes them is run (because it is run too early).

So I want to make sure that that the “cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]enabled[/COLOR]” stays false until the last “cirBG_txt” is faded to 100% alpha by the final “txtTween”.

If using any fundamentally poor techniques here (like nesting onMotionFinisheds?) please let me know.
[AS]
[FONT=Courier New][LEFT][COLOR=#000000]function[/COLOR] makeMenuNumCOLOR=#000000[/COLOR]:[COLOR=#0000ff]Void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] menuHolder_mc:[COLOR=#0000ff]MovieClip[/COLOR] = [COLOR=#0000ff]_root[/COLOR].[COLOR=#0000ff]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“menuHolder”[/COLOR], menuHolderLevel[COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] counter:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]1[/COLOR];
[COLOR=#000000]var[/COLOR] circleCount:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]1[/COLOR];
[COLOR=#000000]var[/COLOR] freq:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]2[/COLOR];
[COLOR=#000000]var[/COLOR] totalCircles = [COLOR=#000080]6[/COLOR];
[COLOR=#000000]var[/COLOR] cirIndex:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]0[/COLOR];
menuHolder_mc.[COLOR=#0000ff]_y[/COLOR] = title_txt.[COLOR=#0000ff]_y[/COLOR]+title_txt.[COLOR=#0000ff]_height[/COLOR]+[COLOR=#000080]30[/COLOR];
menuHolder_mc.[COLOR=#0000ff]_x[/COLOR] = [COLOR=#000080]26[/COLOR];
[COLOR=#000000]var[/COLOR] menuBGHolder:[COLOR=#0000ff]MovieClip[/COLOR] = [COLOR=#0000ff]_root[/COLOR].[COLOR=#0000ff]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“menuBGs”[/COLOR], menuBGHolderLevel[COLOR=#000000])[/COLOR];
menuHolder_mc.[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]counter%freq == [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] cir:[COLOR=#0000ff]MovieClip[/COLOR] = menuHolder_mc.[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“circle”[/COLOR], [COLOR=#ff0000]“circle”[/COLOR]+circleCount, circleCount[COLOR=#000000])[/COLOR];
cir.[COLOR=#0000ff]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]var[/COLOR] cir_txt:[COLOR=#0000ff]TextField[/COLOR] = cir.[COLOR=#0000ff]createTextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“num_txt”[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
cir_txt.[COLOR=#0000ff]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]var[/COLOR] cirAlphaTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cir, [COLOR=#ff0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]8[/COLOR], [COLOR=#000000]false[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] cirTxtAlphaTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cir_txt, [COLOR=#ff0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Strong[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
cirAlphaTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] cirBG:[COLOR=#0000ff]MovieClip[/COLOR] = menuBGHolder.[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“bulletBG”[/COLOR], [COLOR=#ff0000]“bulletBG”[/COLOR]+cirIndex, cirIndex[COLOR=#000000])[/COLOR];
cirBG.[COLOR=#000080]indexNum[/COLOR] = cirIndex;
[COLOR=#000000]var[/COLOR] cirBG_txt:[COLOR=#0000ff]TextField[/COLOR] = cirBG.[COLOR=#0000ff]createTextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“bg_txt”[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
cirBG_txt.[COLOR=#0000ff]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
cirBG_txt.[COLOR=#0000ff]text[/COLOR] = stepsXML.[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR]cirIndex[COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR];
cirIndex++;
[COLOR=#000000]var[/COLOR] txtTweenArr:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] maskTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]mask[/COLOR], [COLOR=#ff0000]"_x"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]mask[/COLOR].[COLOR=#0000ff]_x[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
maskTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] txtTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cirBG_txt, [COLOR=#ff0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
txtTweenArr.[COLOR=#0000ff]push[/COLOR]COLOR=#000000[/COLOR];
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]onRollOver[/COLOR] = rollOverEffect;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]onRollOut[/COLOR] = cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]bgGrad[/COLOR].[COLOR=#0000ff]onDragOut[/COLOR]=rollOffEffect;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]onRelease[/COLOR] = transToFirstStep;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]enabled[/COLOR] = [COLOR=#000000]false[/COLOR];
[COLOR=#808080]//[/COLOR]
txtTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000ff]enabled[/COLOR] = [COLOR=#000000]true[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]//[/COLOR]
circleCount++;
[COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]delete[/COLOR] menuHolder_mc.[COLOR=#0000ff]onEnterFrame[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
counter++;
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}
[/AS]
[/COLOR] [/LEFT]
[/FONT]

Thanks for the reply Mr. Redleaf :slight_smile:

I have to apologize as I don’t think my attempt at a simplified version of my script was adequate in explaining my problem. I pulled the following function out of my project and took out as much non-relevant stuff as i could.

The problem im haveing is that the user is able to click and activate my .onRelease function before all of the menu text has been created. This results in the possibility of text fields not being removed/hidden when the next animation begins, because they do not yet exist before the scipt that removes them is run (because it is run too early).

So I want to make sure that that the “cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]enabled[/COLOR]” stays false until the last “[COLOR=#000000][/COLOR]cirBG_txt” is faded to 100% alpha by the final “txtTween”.

If using any fundamentally poor techniques here (like nesting onMotionFinisheds?) please let me know.

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]function[/COLOR] makeMenuNumCOLOR=#000000[/COLOR]:[COLOR=#0000FF]Void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] menuHolder_mc:[COLOR=#0000FF]MovieClip[/COLOR] = [COLOR=#0000FF]_root[/COLOR].[COLOR=#0000FF]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“menuHolder”[/COLOR], menuHolderLevel[COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] counter:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]1[/COLOR];
[COLOR=#000000]var[/COLOR] circleCount:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]1[/COLOR];
[COLOR=#000000]var[/COLOR] freq:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]2[/COLOR];
[COLOR=#000000]var[/COLOR] totalCircles = [COLOR=#000080]6[/COLOR];
[COLOR=#000000]var[/COLOR] cirIndex:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR];
menuHolder_mc.[COLOR=#0000FF]_y[/COLOR] = title_txt.[COLOR=#0000FF]_y[/COLOR]+title_txt.[COLOR=#0000FF]_height[/COLOR]+[COLOR=#000080]30[/COLOR];
menuHolder_mc.[COLOR=#0000FF]_x[/COLOR] = [COLOR=#000080]26[/COLOR];
[COLOR=#000000]var[/COLOR] menuBGHolder:[COLOR=#0000FF]MovieClip[/COLOR] = [COLOR=#0000FF]_root[/COLOR].[COLOR=#0000FF]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“menuBGs”[/COLOR], menuBGHolderLevel[COLOR=#000000])[/COLOR];
menuHolder_mc.[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]counter%freq == [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] cir:[COLOR=#0000FF]MovieClip[/COLOR] = menuHolder_mc.[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“circle”[/COLOR], [COLOR=#FF0000]“circle”[/COLOR]+circleCount, circleCount[COLOR=#000000])[/COLOR];
cir.[COLOR=#0000FF]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]var[/COLOR] cir_txt:[COLOR=#0000FF]TextField[/COLOR] = cir.[COLOR=#0000FF]createTextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“num_txt”[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
cir_txt.[COLOR=#0000FF]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]var[/COLOR] cirAlphaTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cir, [COLOR=#FF0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]8[/COLOR], [COLOR=#000000]false[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] cirTxtAlphaTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cir_txt, [COLOR=#FF0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Strong[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
cirAlphaTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] cirBG:[COLOR=#0000FF]MovieClip[/COLOR] = menuBGHolder.[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“bulletBG”[/COLOR], [COLOR=#FF0000]“bulletBG”[/COLOR]+cirIndex, cirIndex[COLOR=#000000])[/COLOR];
cirBG.[COLOR=#000080]indexNum[/COLOR] = cirIndex;
[COLOR=#000000]var[/COLOR] cirBG_txt:[COLOR=#0000FF]TextField[/COLOR] = cirBG.[COLOR=#0000FF]createTextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“bg_txt”[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
cirBG_txt.[COLOR=#0000FF]_alpha[/COLOR] = [COLOR=#000080]0[/COLOR];
cirBG_txt.[COLOR=#0000FF]text[/COLOR] = stepsXML.[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]childNodes[/COLOR][COLOR=#000000][[/COLOR]cirIndex[COLOR=#000000]][/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]nodeValue[/COLOR];
cirIndex++;
[COLOR=#000000]var[/COLOR] txtTweenArr:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]Array[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] maskTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]mask[/COLOR], [COLOR=#FF0000]"_x"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]mask[/COLOR].[COLOR=#0000FF]_x[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
maskTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] txtTween:Tween = [COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]cirBG_txt, [COLOR=#FF0000]"_alpha"[/COLOR], mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].[COLOR=#000080]Regular[/COLOR].[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000080]100[/COLOR], [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
txtTweenArr.[COLOR=#0000FF]push[/COLOR]COLOR=#000000[/COLOR];
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]onRollOver[/COLOR] = rollOverEffect;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]onRollOut[/COLOR] = cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]bgGrad[/COLOR].[COLOR=#0000FF]onDragOut[/COLOR]=rollOffEffect;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]onRelease[/COLOR] = transToFirstStep;
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]enabled[/COLOR] = [COLOR=#000000]false[/COLOR];
[COLOR=#808080]//[/COLOR]
txtTween.[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
cirBG.[COLOR=#000080]masked[/COLOR].[COLOR=#000080]hit[/COLOR].[COLOR=#0000FF]enabled[/COLOR] = [COLOR=#000000]true[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]//[/COLOR]
circleCount++;
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]delete[/COLOR] menuHolder_mc.[COLOR=#0000FF]onEnterFrame[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
counter++;
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

:lol: I think your main problem is all of the HTML overwhelming your code - could you repost please?

hmm…

[AS]
function makeMenuNum():Void {
var menuHolder_mc:MovieClip = _root.createEmptyMovieClip(“menuHolder”, menuHolderLevel);
var counter:Number = 1;
var circleCount:Number = 1;
var freq:Number = 2;
var totalCircles = 6;
var cirIndex:Number = 0;
menuHolder_mc._y = title_txt._y+title_txt._height+30;
menuHolder_mc._x = 26;
var menuBGHolder:MovieClip = _root.createEmptyMovieClip(“menuBGs”, menuBGHolderLevel);
menuHolder_mc.onEnterFrame = function() {
if (counter%freq == 0) {
var cir:MovieClip = menuHolder_mc.attachMovie(“circle”, “circle”+circleCount, circleCount);
cir._alpha = 0;
var cir_txt:TextField = cir.createTextField(“num_txt”, 0, 0, 0, 0, 0);
cir_txt._alpha = 0;
var cirAlphaTween:Tween = new Tween(cir, “_alpha”, mx.transitions.easing.Regular.easeOut, 0, 100, 8, false);
var cirTxtAlphaTween:Tween = new Tween(cir_txt, “_alpha”, mx.transitions.easing.Strong.easeOut, 0, 100, 0.5, true);
cirAlphaTween.onMotionFinished = function() {
var cirBG:MovieClip = menuBGHolder.attachMovie(“bulletBG”, “bulletBG”+cirIndex, cirIndex);
cirBG.indexNum = cirIndex;
var cirBG_txt:TextField = cirBG.createTextField(“bg_txt”, 0, 0, 0, 0, 0);
cirBG_txt._alpha = 0;
cirBG_txt.text = stepsXML.firstChild.childNodes[cirIndex].firstChild.firstChild.nodeValue;
cirIndex++;
var txtTweenArr:Array = new Array();
var maskTween:Tween = new Tween(cirBG.masked.mask, “_x”, mx.transitions.easing.Regular.easeOut, cirBG.masked.mask._x, 0, 0.5, true);
maskTween.onMotionFinished = function() {
var txtTween:Tween = new Tween(cirBG_txt, “_alpha”, mx.transitions.easing.Regular.easeOut, 0, 100, 0.5, true);
txtTweenArr.push(txtTween);
cirBG.masked.hit.onRollOver = rollOverEffect;
cirBG.masked.hit.onRollOut = cirBG.masked.bgGrad.onDragOut=rollOffEffect;
cirBG.masked.hit.onRelease = transToFirstStep;
cirBG.masked.hit.enabled = false;
//
txtTween.onMotionFinished = function() {
cirBG.masked.hit.enabled = true;
};
};
};
//
circleCount++;
if (circleCount>totalCircles) {
delete menuHolder_mc.onEnterFrame;
}
}
counter++;
};
}
[/AS]

i dunno what the hell happened there. I tried to make it all neat and tidy with the AS tags, but after i previewed it, it got all wacked out with the html?

Ya there’s something funcky with VB :slight_smile:

Anyways, give this a whirl:

import mx.transitions.Tween;
function makeMenuNum():Void {
 var menuHolder_mc:MovieClip = _root.createEmptyMovieClip("menuHolder", menuHolderLevel);
 var counter:Number = 1;
 var circleCount:Number = 1;
 var freq:Number = 2;
 var totalCircles = 6;
 var cirIndex:Number = 0;
 menuHolder_mc._y = title_txt._y + title_txt._height + 30;
 menuHolder_mc._x = 26;
 var menuBGHolder:MovieClip = _root.createEmptyMovieClip("menuBGs", menuBGHolderLevel);
 menuHolder_mc.onEnterFrame = function() {
  if (counter % freq == 0) {
   var cir:MovieClip = menuHolder_mc.attachMovie("circle", "circle" + circleCount, circleCount);
   cir._alpha = 0;
   var cir_txt:TextField = cir.createTextField("num_txt", 0, 0, 0, 0, 0);
   cir_txt._alpha = 0;
   var cirAlphaTween:Tween = new Tween(cir, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 8, false);
   var cirTxtAlphaTween:Tween = new Tween(cir_txt, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 0.5, true);
   cirAlphaTween.onMotionFinished = function() {
    var cirBG:MovieClip = menuBGHolder.attachMovie("bulletBG", "bulletBG" + cirIndex, cirIndex);
    cirBG.indexNum = cirIndex;
    var cirBG_txt:TextField = cirBG.createTextField("bg_txt", 0, 0, 0, 0, 0);
    cirBG_txt._alpha = 0;
    cirBG_txt.text = stepsXML.firstChild.childNodes[cirIndex].firstChild.firstChild.nodeValue;
    cirIndex++;
    var txtTweenArr:Array = new Array();
    var maskTween:Tween = new Tween(cirBG.masked.mask, "_x", mx.transitions.easing.Regular.easeOut, cirBG.masked.mask._x, 0, 0.5, true);
    maskTween.onMotionFinished = function() {
     var txtTween:Tween = new Tween(cirBG_txt, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 0.5, true);
     txtTweenArr.push(txtTween);
     cirBG.masked.hit.onRollOver = rollOverEffect;
     cirBG.masked.hit.onRollOut = cirBG.masked.bgGrad.onDragOut = rollOffEffect;
     cirBG.masked.hit.onRelease = transToFirstStep;
     cirBG.masked.hit.enabled = false;
     //
     if (circleCount == totalCircles) {
      txtTween.onMotionFinished = function() {
       cirBG.masked.hit.enabled = true;
      };
     }
    };
   };
   //
   circleCount++;
   if (circleCount > totalCircles) {
    delete menuHolder_mc.onEnterFrame;
   }
  }
  counter++;
 };
}

:?)

Unless I over looked something it looks like you just added an if…then statement around the code that enables the buttons


...
if (circleCount == totalCircles) {
                        txtTween.onMotionFinished = function() {
                            trace("cirBG: "+cirBG);
                            cirBG.masked.hit.enabled = true;
                        };
                    }
...

This isn’t working though because the “circleCount” is counting up before even the first “maskTween.onMotionFinished” is finished. may be i need to make a dedicated counter just for the button enabling…hmmm

dude, your’re right after all! i just need to replace the “==” with “>”

as always, i appreciate the help from the North!