Thanks Gordon. Can I ask what would happen if you had an attribute the same name as a style and the same name as an event and you tried to set this in the mxml?
Or would this not be allowed? If its not allowed it seems like events and styles should automatically create getters/setters of their variable types on the classes so that you programmatically could do something like component.someEventName = someFunctionName; instead of component.addEventListener("foo",bar); and the variable would be of type EventListener, or something. /shrug It just feels sort of hackish if you know what I mean. Seth From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gordon Smith Sent: Friday, December 21, 2007 1:55 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] setting mxml attributes in actionscript when those properties don't exist Some MXML attributes specify properties, some specify styles, some specify event handler bodies, and some specify effects. (And some, like 'id', get special handling.) The programmatic way to set a property is component.foo = bar; The programmatic way to set a style or effect is component.setStyle("foo", "bar"); The programmatic way to set an event handler is component.addEventListener("foo", bar); Gordon Smith Adobe Flex SDK Team _____ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Seth Caldwell Sent: Friday, December 21, 2007 11:25 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] setting mxml attributes in actionscript when those properties don't exist Well, I solved the problem by using adgc.setStyle("headerStyleName","someStyle"); - however I'm still confused as to how there are attributes you can specify in mxml that can't be set programmatically. I've encountered this elsewhere also - is it just a styles thing? Seth From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Seth Caldwell Sent: Friday, December 21, 2007 11:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] setting mxml attributes in actionscript when those properties don't exist For example, I'm wanting to set the headerStyleName on an AdvancedDataGridColumn. which you can do with mxml: <mx:AdvancedDataGridColumn headerStyleName="someStyle"/> However, when I try to do it with actionscript: var adgc:AdvancedDataGridColumn = new AdvancedDataGridColumn(); adgc.headerStyleName = "someStyle"; I get the error that headerStyleName is not defined on AdvancedDataGridColumn. Huh? Whats going on here, and how can I set it programmatically? Thanks, Seth