--- In [email protected], "Troy Gilbert" <[EMAIL PROTECTED]>
wrote:
>
> > In my Sprite object, how come I can't do:
> >
> >  for each( var child:Sprite in this.children ) {
> >  // do something
> >  }
> >
> >  I can do a simple for loop, but this can not be run in parallel on a
> >  multicore chip. Whereas the above code could (100 children, 100 cores
> >  on my chip = each core runs the code)
> 
> In theory, yes, a foreach could be optimized by a compiler to leverage
> mutlicores whereas a forloop cannot... but in the case of Flash, in
> particular the AVM2 (the Actionscript Virtual Machine v2) is not
> designed to distribute code across multiple cores.
> 
> If that's something that you're looking for, Flash may be the wrong
> environment for you... ;-)
> 
> Troy.
>

No, I just want to do this:

for each( var child:Sprite in this.children ) {
// do something
}

I'm not bothered about 100 cores :-)

Why do I have to use a normal for loop? Why can't I do for each? Is it
a technical reason inside Sprite?

monk.e.boy


Reply via email to