OK danny, your script work fine. sorry for not testing it first. 
here is the script in conjunction to my prior post. on frame 1:
  var tIndex = 1;
//---------------------------------
// calculate the "loop overhead"
var looptimestart = getTimer();
//---------------------------------
_root.onEnterFrame = function() {
 for (var i = 0; i<7; i++) {
  //OK!! ASYNCHRONOUS DEPTH NUMBER for attaching MC
  //trace("Drawing first Icon =" + tIndex++ + " - " + tIndex++ + " - " + 
tIndex++ + " - " + tIndex++ + " - " + tIndex++ + " - " + tIndex++ + " - " + 
tIndex++);
  addIcon("myIcon", tIndex++);
  if (tIndex>700) {
   //----------------------------------------------
   trace(getTimer()-looptimestart+" ms");
   //----------------------------------------------
   delete _root.onEnterFrame;
   break;
  }
 }
 var time = getTimer()-looptimestart;
 status.text = "times elapsed : "+time+" ms";
};
function addIcon(sLinkage:String, nDepth:Number):Void {
 var mc:MovieClip = this.attachMovie(sLinkage, "mcIcon"+nDepth, nDepth, 
{_x:Math.random()*450+50, _y:Math.random()*300+50});
 trace(mc._name);
}
  it seems that I only gain the ASYNC -sequential number but not 
the ASYNC method for attaching movieClip. the above script 
will run in average 3300 miliseconds on my old but the only 
one PC i have: athlon 1.3 Ghz. 
  the code below run almost 2 times faster, in average 1800 ms:
  var a = 1;
var b = 2;
var c = 3;
var d = 4;
var e = 5;
var f = 6;
var g = 7;
  //---------------------------------
// calculate the "loop overhead"
var looptimestart = getTimer();
//---------------------------------
trace("Drawing first Icon =" + a + " - " + b + " - " + c + " - " + d + " - " + 
e + " - " + f + " - " + g);
drawIcon("myIcon");
  trace("Drawing Next Icon =" + newline);
  _root.onEnterFrame = function(){
 
 a +=7;
 b +=7;
 c +=7;
 d +=7;
 e +=7;
 f +=7;
 g +=7;
 
 //ASYNCHRONOUS DEPTH NUMBER for attaching MC
 trace(a + " - " + b + " - " + c + " - " + d + " - " + e + " - " + f + " - " + 
g);
   drawIcon("myIcon");
 
 if (g>700-7){
  delete _root.onEnterFrame ;
  //----------------------------------------------
  trace(getTimer()-looptimestart+" ms");
  //----------------------------------------------
 }
 var time = getTimer()-looptimestart;
 status.text = "times elapsed : " + time + " ms";
}
  function drawIcon(sLinkage:String):Void {
 //attaching mc simultaneously: must be at different depth!!!
 //Using seven counter i.e: a-g which count the depth inside 
 //onEnterFrame loops
 this.attachMovie(sLinkage, "mcIcon" + a, a, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + b, b, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + c, c, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + d, d, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + e, e, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + f, f, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
 this.attachMovie(sLinkage, "mcIcon" + g, g, {_x:Math.random()*450+50, 
_y:Math.random()*300+50});
}
  the above code attach 7 clip at the same time.  
I intentionally left the script with its primitive shape merely for witnessing 
the loop. 
Using debug (list object) the same script also generate the same number of 
movieclip
on stage. 
  based on that, your approach is even better (700 ms);
i just paste addIcon("myIcon", tIndex++) for simultaneous attach!
  var tIndex = 1;
//---------------------------------
// calculate the "loop overhead"
var looptimestart = getTimer();
//---------------------------------
_root.onEnterFrame = function() {
 for (var i = 0; i<7; i++) {
  //OK!! ASYNCHRONOUS DEPTH NUMBER for attaching MC
  //trace("Drawing first Icon =" + tIndex++ + " - " + tIndex++ + " - " + 
tIndex++ + " - " + tIndex++ + " - " + tIndex++ + " - " + tIndex++ + " - " + 
tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  addIcon("myIcon", tIndex++);
  if (tIndex>700) {
   //----------------------------------------------
   trace(getTimer()-looptimestart+" ms");
   //----------------------------------------------
   delete _root.onEnterFrame;
   break;
  }
 }
 var time = getTimer()-looptimestart;
 status.text = "times elapsed : "+time+" ms";
};
function addIcon(sLinkage:String, nDepth:Number):Void {
 var mc:MovieClip = this.attachMovie(sLinkage, "mcIcon"+nDepth, nDepth, 
{_x:Math.random()*450+50, _y:Math.random()*300+50});
 trace(mc._name);
}
   
   
  following the thread, jesse seem provides much nicer solution, 
  although i haven't check it yet.
   
  :) thanks for showing me a more elegant approach. 


Danny Kodicek <[EMAIL PROTECTED]> wrote:
  
> onEnterFrame/setInterval function is just to give spreading 
> effect to the app. 
> as I mention earlier, using for loop doesnt't let any 
> animation play before loop ends. 
> the real problem is only about the SEQUENCE-PATTERN. 

I got that. Check my code again and you'll see what it's doing: it's running
seven iterations in each frame, which should give you the effect you're
looking for.

Danny

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to