gnash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash] Question about event handling in swf/flash


From: strk
Subject: Re: [Gnash] Question about event handling in swf/flash
Date: Sun, 7 Sep 2008 12:01:39 +0200

On Thu, Sep 04, 2008 at 05:41:52PM -0700, j.random.programmer wrote:
> Hi:
> 
> I am trying to figure out how event handling dispatchers work in flash/.swf.
> 
> Specifically, is there a *separat*e event handler thread that invokes the 
> callback event handler methods or is that done by the main thread, in between 
> frame by frame execution ?

Main thread only.

> My understanding so far is that there is:
> 
> 1) There is only one (1) execution thread. No separate event-dispatch thread 
> exists in the player. (unlike, say java, where all events are dispatched in 
> the awt-event-dispatcher).

Correct.

> 2) Events and callbacks (such as with setTimeout) are "queued" and the main 
> thread pops events off the queue and invokes them. This is true both for 
> events recieved from the operating system (network data, for example) and for 
> things like mouseclicks.

More or less. For network data it's a kind of mix (channels are polled) but 
still the triggers
execute in main thread.

> 3) The main method also invokes code at each "frame". It invokes queued 
> events in between frames (or maybe along with them, don't know ?)

User events are invoked immediately, frame events on frame rate boundary.

> Is this understanding by are large true ? This implies that it is possible to 
> hang the player entirely by saying "while (true) { }" in an event handler ? 

Yes, even the proprietary player behaves like this.
There's a limit on how long an action can take so the player won't hung 
forever, but once
the limit is hit no actions will be executed anymore (we still miss support for 
prompting user
about what to do in that case, the proprietary player does prompt user).

--strk;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]