Sorry, I must have not explained well. The race condition I'm talking
about exists here:

thread 1: calls load() and say someFlag gets set to 1;
thread 2: calls load() and someFlag is set to 2;
thread 1: the first load is complete and handleComplete() is called,
but someFlag is set to 2 when the value I want is 1.

I want to attach a copy of the value of someFlag to the event so in
handleComplete() I could call event.target.someFlagCopy and always get
the value that was set in *that* thread's load() call.

Does that make any sense?

-R

--- In [email protected], "Daniel Gold" <[EMAIL PROTECTED]> wrote:
>
> does determineFlag() do some asynch service call? If so you need to
wait and
> raise an event or update a var in a model and listen for changes
that way.
> Otherwise your determineFlag() method will run to completion before the
> loader.loadSomeStuff() line is executed, Flash is single threaded
for user
> code execution so you shouldn't have a race condition there
> 
> On Mon, Jun 9, 2008 at 3:55 PM, robbarreca <[EMAIL PROTECTED]>
> wrote:
> 
> >   Say I have two functions load() and handleComplete(event:Event).
Right
> > now to get custom data to handleComplete I do something like this
> >
> > private var someFlag:uint = 0;
> >
> > function load() {
> > loader.addEventListener(handleComplete);
> > someFlag = determineFlag();
> > loader.loadSomeStuff();
> > }
> >
> > function handleComplete(event:Event) {
> > trace(someFlag);
> > }
> >
> > But if I call this super fast, someFlag is gonna be wrong. I've seen a
> > method where you can add an anonymous function somehow, but I'm pretty
> > sure that even faced the same race condition problem. What is the
> > *proper* way to go about this?
> >
> >  
> >
>


Reply via email to