> 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? I'm not sure what the compiler does in this case, but even if it allows it we'd consider it bad practice because of the ambiguity. > events and styles should automatically create getters/setters This is an interesting idea, but it would increase the SWF size while gaining relatively minor benefit (at least in my opinion). > It just feels sort of hackish if you know what I mean. You probably feel it's hackish because the syntax for setting properties, styles, and events is the same in MXML but different in AS. But the AS syntax is "real" in the sense of showing what is actually happening at the level of the Player and framework APIs. The MXML syntax is "sugar" due to the simplicity of using XML attributes to specify three things which under the covers are really quite different. You're advocating hiding these differences at the AS level as well, which I think could cause more confusion than you're trying to solve. I'd be interested to hear others' opinions on this. Gordon Smith Adobe Flex SDK Team
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Seth Caldwell Sent: Friday, December 21, 2007 5:19 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] setting mxml attributes in actionscript when those properties don't exist 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