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.

On 2/16/07, David Cohn <[EMAIL PROTECTED]> wrote:
Hey all,

As per my earlier thread, I've been playing around with the
"Component Definition" dialog box in order to create a class which
extends MovieClip, where the class can be "passed parameters" (or,
set in the Parameters tab as the case may be).  This seems to
implement what I want, but I'm puzzled about the behavior of the
"Component Definition" dialog box. What I do is:

-- Set "Linkage...":

        AS 2.0 Class:   MyPackage.myClass


-- Open "Component Definition..." and enter Parameters like:

        Parameters:
                Type    sType   typeA   String
                Degree  nDegree 37.5    Number


-- Now, what puzzles me is the behavior of the "AS 2.0 Class" field
in this dialog box:


        AS 2.0 Class:   MyPackage.myClass(val)

                -- this seems to work; the parameters are set correctly for the
instance.
                        Puzzlement 1: "val" can be *anything*, as long as it's 
just one
word (e.g. it can't be "sType,nDegree") and the parameters are set
correctly!


        AS 2.0 Class:   MyPackage.myClass()

                -- this gives me a syntax error


        AS 2.0 Class:   MyPackage.myClass

                -- Puzzlement 2: this causes all the parameters to disappear 
next
time the dialog box is open, and the parameters aren't set for the
instance!


Am I using this thing right?  I can't make heads or tails of what's
going on!

Thanks,
--Dave

_______________________________________________
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



--
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry & Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
_______________________________________________
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