<SomeClass id="sc" selectedIndex="{SomeClass.ID2}" >
<dataProvider> <mx:String>Alpha</mx:String> <mx:String>Beta</mx:String> <mx:String>Gamma</mx:String> </dataProvider> </SomeClass> Where: package { import mx.controls.ComboBox; public class SomeClass extends ComboBox { public static const ID1:int = 1; public static const ID2:int = 2; public static const ID3:int = 3; public function SomeClass() { super(); } } } ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of gary_mangum Sent: Monday, June 04, 2007 9:52 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Custom Attributes I just tried this with hotfix 2 and it did not work any differently for me. Can you point me to the example that you saw working so that I can try it? Also, how can I verify that I have hotfix 2 installed? The windows installer was not working (see my other post) so I ended up unzipping the zip hotfix 2 instead. Gary --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > I saw an internal discussion that there may have been a bug. I tried a > similar example in hotfix 2 and it worked for me so upgrade to hotfix 2 > and give it a try there. > > > > -Alex > > > > ________________________________ > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of gary_mangum > Sent: Saturday, June 02, 2007 6:48 PM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: Custom Attributes > > > > So, can something like this be done or not? I want to define a bunch > of constant values and pass them in as the value for a custom > attribute. Can I do this? I don't want to hard code these values. > > Thanks! > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > , "Alex Harui" <aharui@> wrote: > > > > There used to be warnings. I can't recall if we've gotten around them > > yet, but you still might be getting hit up by some initialization > thing. > > Try looking in your trace output, it might be a runtime warning. > > > > > > > > Also dump out the value of that constant at various time. It might > > start out 0 and gets set to 2 during component instantiation. > > > > > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > ] On > > Behalf Of gary_mangum > > Sent: Friday, June 01, 2007 3:33 PM > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] Re: Custom Attributes > > > > > > > > Thanks for your response! > > > > I am not getting any compiler errors...should I be? Is it illegal to > > assign constant values to an attribute? > > > > I am trying to create an attribute that is an integer "mask" and then > > use OR-ed together constants to pass in and set the attribute? Isn't > > this possible? > > I'd hate to hard code all of my attribute values to magic numbers if > > it is possible to use constants instead for readability and > > maintainability. > > > > In my example, myComponent.xml is the class, not MyComponent. > > > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > , "Alex Harui" <aharui@> wrote: > > > > > > Aren't you getting compiler warnings about binding to statics? > > > > > > > > > > > > What is "myComponent"? "MyComponent" is the class, but "myComponent" > > > must be something else? > > > > > > > > > > > > ________________________________ > > > > > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > ] On > > > Behalf Of gary_mangum > > > Sent: Friday, June 01, 2007 10:53 AM > > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] Re: Custom Attributes > > > > > > > > > > > > Still haven't figured this one out...is this a bug in flex? > > > > > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > > , "gary_mangum" <garym@> wrote: > > > > > > > > I am unsuccessfully trying to pass an integer constant to a custom > > > > integer attribute of a custom component. Confused yet? Here's an > > > > example of what I am trying to do: > > > > > > > > Application: > > > > <?xml version="1.0"?> > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > " > > width="700" > > > > height="250" borderStyle="solid" xmlns:ns1="*"> > > > > <ns1:myComponent supportsMultiselect="true" > > > > supportTypeMask="{myComponent.TYPE_MASK_TEXT}"/> > > > > </mx:Application> > > > > > > > > MyComponent: > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Button xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > > > "> > > > > <mx:Script> > > > > <![CDATA[ > > > > public static const TYPE_MASK_ALL:int = -1; > > > > public static const TYPE_MASK_NONE:int = 0; > > > > public static const TYPE_MASK_IMAGE:int = 1; > > > > public static const TYPE_MASK_TEXT:int = 2; > > > > public static const TYPE_MASK_SPRITE:int = 4; > > > > > > > > public var supportsMultiselect:Boolean; > > > > public var supportTypeMask:int; > > > > ]]> > > > > </mx:Script> > > > > </mx:Button> > > > > > > > > > > > > The public var supportTypeMask is never getting set for some > reason > > if > > > > I try to pass it one of the constants. If I pass "2" instead of > > > > "{myComponent.TYPE_MASK_TEXT}" it works great. > > > > > > > > Any ideas about what I am doing wrong here? > > > > > > > > Thanks for your help! > > > > > > > > > >