If you're using Flash CS3 and publish for player 9, then you can simply
use SWFLoader to load the SWF and then make instances of the classes.
You should use a LoaderContext(false, ApplicationDomain.currentDomain)
to get the classes into the top-level application domain

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alan Shaw
Sent: Tuesday, February 26, 2008 5:17 PM
To: [email protected]
Subject: [flexcoders] Run-time loading of library symbols as custom
class instances: How?

 

I'm working on a pure AS3 project in FlexBuilder 3.  All graphical
assets are provided as symbols (with no AS code) in a library swf,
exported as this example: symbol Name: cloud01, Class: cloud01, Base
class: flash.display.MovieClip.  The corresponding class looks like
this:

package com.my.package
{
    [Embed(source="/path/to/library.swf", symbol="cloud01")]
    public class Cloud01 extends Cloud
    {
        public function Cloud01()
        {
            super();
        }
        
    }
}

Most of these ultimately derive from a custom Animation class whose API
allows various manipulations of the playhead.

Since the assets are all embedded, trying out new versions of the
animations requires recompilation.  It is desirable to get around that
requirement so the animators themselves, not programmers, can make a new
library swf using the Flash IDE and see the effects.  I haven't found
anything that works yet, although there have been hints in the big fat
Moock book (p.795) and in Grant Skinner's blog that it is possible to
load these assets at run time and have them come in as instances of the
desired types.

Any help?

Thanks,
-A

 

Reply via email to