Because the control name isn't a Label but a String?
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of gregariousgregmi Sent: Thursday, July 03, 2008 1:03 PM To: [email protected] Subject: [flexcoders] Dynamically Set Controls to be Required I have several comboboxes that I want to set to be required based on a login id. I have an array of objects; each object contains a string variable that is the label name of the combo box that I want to be required. The line that sets the styleName to required returns a "Error #1009: Cannot access a property or method of a null object reference." required is defined in the css file. Any ideas? private function getFormControlProperties_Result(evt:ResultEvent):void { if( evt.result == null ) return; tArray = evt.result as Array; for( var i:int=0; i<tArray.length; i++ ){ if( tArray[i].IsRequired == 1 ) (tArray[i].ControlName as Label).styleName="required"; } }

