|
Nice find! From: I finally found a neat way to decorate
SWF7 classes with SWF8 functionality. It worked with a simple test case so I
still need to test it against a more complex example but the basic idea is the
following: - there's an interface called IFoo that defines all
functions that should be available later in the game (i.e. browse()) - there's a class called FooStub that implements the
interface IFoo but does not provide any functionality - there's a class called FooImpl that also implements the
interface IFoo and defines the full functionality (e.g. use some FP8 features
like FileReference and call browse on it) The magic comes with a function decorateStub(fooStub:Function):Void { this compiles to decorator.swf and gets loaded into the
Flex 1.5 application by using mx.controls.Loader. Inside the Flex application after the Loader completes
loading the decorator.swf the FP8 functionality gets added to the FooStub class
by doing private function decoratorLoaded(event:Object):Void { // event.target is the Loader event.target.content.decorateStub(FooStub); } Now the FooStub class points to the FooImpl class and doing
a new FooStub() really runs the FooImpl code - by using the IFoo interface
everything plays nicely with the Flex compiler. Again, I have to test a few things but this really seems to
work nicely. Dirk. Von: Classes are actually just magic definitions on
_global. If you were to -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
Title: RE: [flexcoders] Loading a Flash 8 compiled AS 2.0 class into a Flex app
and instantiate it

