[Flashcoders] Dynamic runtime class', another example.

2005-11-29 Thread Jos Yule
I've just done some experimenting with dynamic runtime class'. I think
what i've come up with might be interesting to others who are
experimenting in this area. One thing that i think is different from
other methods that i've seen, is the use of Deferreds [1][2], allowing
for asynchronous calls to class' that are not yet loaded, but from
which you want to get back the results of your call. Also the ability
to set wether you want a method to be asynchronous or not (via naming
magic - ie. add '_deferred' to any method call (mymethod_deferred),
and you make that method asynchronous).

The code is not 100% stable good to go into the enterprise or
anything, but i hope that it is an example of (yet another) way to
handle runtime dynamic class'.

You can see my (long) post here:
http://www.theorganization.net/mt/archives/2005/11/29/flash_dynamic_runtime_class.html
tinurl:
http://tinyurl.com/96usc

Check the second update, that's where i have instructions for making
the demo work. Or read the whole rambling thing!

[1]: http://mochikit.com/doc/html/MochiKit/Async.html
[2]: http://twistedmatrix.com/projects/core/documentation/howto/defer.html

--
Jos Yule
Digital Hyakugei
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Dynamic runtime class', another example.

2005-11-29 Thread Jos Yule
 Hi,
 first off: cool ;).
 Question though, since flash idea of multithreading is that there are no
 real threads for us to create and each method runs synchronized (as in
 public synchronized as in java), what would be a case where i would wanna
 use asynchronous callbacks?

They are used here to support the following case:

You wrap a dynamic class. It takes time for that class to load, but
you want to call some methods on that class right away, before its
loaded. By registering callbacks, you can call a method on the class,
and be calledback when the data is ready. So, in this way, you don't
have to worry about waiting for the class to load, you just tell it to
do something, and it will tell you when it is done.

In the example code that i include in the post, you can see that i've
called the 'output' method of the wrapper instance, and its running
it before the class is loaded. Via callbacks, once the class is
loaded, i get the results of calling those methods.

 I know that the XML object does this, but i think this object since its
 natively implemented and stuff really does run in a separate thread.


Please note that i'm not talking about threads. Perhaps i should have
described it as 'queuing' your function calls.

Thanks for the reply!
j

--
Jos Yule
Digital Hyakugei
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders