Unfortunately, the Inspectable metatag only works for mxml.  Here's a more 
reuseable solution so you can use the same strings when coding in AS3 too.  It 
also will do compile time checking on your selection in either case.

MAIN APPLICATION...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
creationComplete="init()" xmlns:trans="*">

    <mx:Script>
        <![CDATA[

            private function init():void{

                var tr:tranny = new tranny();
                tr.gear = tranny.FIRST;         
            }
        ]]>
    </mx:Script>

    <trans:tranny gear="{tranny.FIRST}"/>

</mx:Application>



TRANNY COMPONENT/CLASS

package
{
    public class tranny{

        private var _gear:String;
                
        public function tranny(){
            super();
        }

        // these const's must match the Inspectable enumeration
        public static const FIRST:String = "first";
        public static const SECOND:String = "second";
        public static const THIRD:String = "third";
                
        [Inspectable(category="Tranny", 
enumeration="{tranny.FIRST},{tranny.SECOND},{tranny.THIRD}")]
        public function set gear(gr:String):void{
            _gear = gr;                         
        }

        public function get gear():String{
            return _gear;
        }
    }
}





--- In [email protected], "turbo_vb" <timh...@...> wrote:
>
> On the line above your setter, use the Inspectable metadata:
> 
> [Inspectable(category="General", enumeration="auto,up,down", 
> defaultValue="auto")]
> 
> -TH
> 
> --- In [email protected], "Warren" <warrenonyaho@> wrote:
> >
> > I'm creating my own actionscript class which will have a public property 
> > accessed via a getter and setter.  I want this property to have one of thew 
> > values: up. down. auto.  How do I set things up so that when I use the 
> > class in Flexbuilder, only these choices appear as property selections?
> > 
> > I'm in Flex 3.2.0
> > 
> > Thanks!
> > 
> > Warren Koch
> >
>


Reply via email to