Hi Iiley,

I am assuming you mean "extend a dynamically loaded class at runtime." 
(Otherwise, of course, you can use regular compile-time inheritance to 
extend classes you include in your DLL swfs.)

You can "extend" a dynamically loaded class at runtime if you use the 
first method and mark it as "dynamic intrinsic".

eg.

// You must define intrinsic classes if you want type checking to work 
with dynamically loaded classes
// If you make it *dynamic* also, you can extend it after loading it 
into your app.

dynamic intrinsic class com.ariaware.tests.dll.library.FirstClass
{
    public function aMethod():Void;
}

Then, once it's been loaded, you can extend it using the good 'ol 
AS1-style prototype object:

eg.

    // Called when the DLL has completely loaded
    private function dllComplete ( evt:DLLEvent )
    {
        //...

        //
        // Extend the library classes
        //
        FirstClass.prototype.aNewMethod = function ()
        {
            trace ("AS1 style baby!");
        };
       
        //
        // Test the library classes
        //
        var firstClass:FirstClass = new FirstClass();
        firstClass.aMethod();
        firstClass.aNewMethod();

       //...
     }

I just wrote up a blog post on it. You can download the updated example 
files from there:
http://www.flashant.org/index.php?p=501&more=1&c=1

hth,
Aral

iiley wrote:

> Hi,
>  
> Today i did some research of "Using a SWF as a DLL", follow the way 
> introduced from "http://www.osflash.org/using_a_swf_as_a_dll?s=dll";, 
> first thanks Aral Balkan and Clément Arnoux's introducion, it's very 
> clear.
>  
> But, after i did some research, i found that you can't extending a 
> class which will be loaded.<snip>



_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to