thanks all for the reply,
now I understand there must be a time slot for flash
to do thie graphic things.
I end up using two listeners to get the job done,
making all the task queue up and run one by one.
--- Stan Vassilev <[EMAIL PROTECTED]>
wrote:
> No that would be a bad idea since flash is single
> threaded.
>
> In pseudo code, Flash runs in an endless loop of
> this kind:
>
> for (;;) {
> executeFrameScript();
> renderFrame();
> }
>
> If you start doing some cycle you make it be stuck
> in "executeFrameScript()"
> and never render a frame before you let it go.
> There's a safety precaution that doesn't let Flash
> be stuck in there for
> more than a few seconds since it might be bug or
> well it's just plain bad
> user experience to run lengthy code and leave the
> GUI frozen.
>
> This is why you have to use async operations such as
> callbacks or make your
> loop use setInterval or onEnterFrame to do the
> looping part (this allows
> Flash to render the graphics part).
>
> Regards, Stan Vassilev
>
> ----- Original Message -----
> From: "Morrisy Van" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, October 26, 2005 9:23 AM
> Subject: [Flashcoders] while(true) and infinite
> loop... :(
>
>
> >
> > hi list,
> >
> > been doing some flex2 AS3 socket programming
> recently,
> > just wondering could i use some code like this (as
> we
> > do in java):
> >
> > [code]
> > String line;
> > for(;;) {
> > line = in.readLine( );
> > if (line == null) throw new
> IOException("Unexpected
> > EOF");
> > if (line.equals(".")) break;
> > msgs.add(line);
> > }
> > [/code]
> >
> > or
> > [code]
> > while(true){
> > //do some socket operation....
> > }
> > [/code]
> >
> > whenever I ran code like this, flash player went
> into
> > infinite loop and crashes.
> >
> > so is there any way to wait until the socket
> finishes
> > it's job and the code went on ?
> >
> > btw, I know there are onSocketData and onProgress
> for
> > socket, but by using them i would have to split my
> > code into chunks and it's gonna be hard to
> maintain.
> >
> > thanks.
> >
> >
> >
> >
> > __________________________________
> > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > http://mail.yahoo.com
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> >
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders