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:[EMAIL PROTECTED] On
Behalf Of gary_mangum
Sent: Friday, June 01, 2007 3:33 PM
To: flexcoders@yahoogroups.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>
, "Alex Harui" <[EMAIL PROTECTED]> 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@yahoogroups.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> 
> 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>
> , "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> > "
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> > ">
> > <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!
> >
>

 

Reply via email to