Thanks, [Inspectable] metadata does the trick!

Where would people go for overview documentation on this stuff?

Flash (8) Help shows nothing for metadata nor Inspectable. I found info on the adobe site once I knew what to look for, but is there a good summary available?

(if possible, anything but livedocs ;)

Thanks again,
--Dave



Look into the [Inspectable] metadata tag.

If you place it before a class variable or property, then setting the
class under the component definition will automatically populate the
parameters.

class MyClass {
    //...
    [Inspectable(defaultValue="default")]
    public var myVar:String;
    [Inspectable]
    public function get myProp():Number {
        return _prop;
    }
    public function set myProp(value:Number):Void {
        _prop = isFinite(value) ? Math.floor(value) : 0;
    }
    private var _prop:Number;
    //...
}

There are other options: enumeration, different types, etc.



Also, leave the "Parameters" in the "Component Definition" window blank, it's there for backwards compatibility and will be filled
in automatically if you use [Inspectable] metadata in your class.
But for that to work you need to fill in the class (including package) in the "AS 2.0 Class" field - just below the paramaters in
the Component Definition window.

When you make changes to a class' [Inspectable] metadata, those changes are not reflected in the fla immediatly. For instance, if you add new Inspectable metadata and you have a movieclip instance on stage, you won't see the properties show up in the Parameters. You'll have to compile the fla first, or make the movieclip a "compiled clip" and recompile it each time you change the class.




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to