i have this function in my project
public function changeFormItemsLabelWidth(form:Form, width:int):void
{
var formItemsArray:Array = form.getChildren();
for( var i:int = 0; i < formItemsArray.length; i++){
if(formItemsArray[i].className == "FormItem"){
var formItem:FormItem = formItemsArray[i] as FormItem;
formItem.setStyle("labelWidth", width);
}
}
and i’m getting this error:
1061: Call to a possibly undefined method getChildren through a reference with static type spark.components:Form.
Can someone tell me how can i replace getchildren method? because i’m migration to flex 4 and this method no longer exists.
EDIT:
Tanks for the help i did something like this and it works
public function changeFormItemsLabelWidth(form:Form, width:int):void
{
var it:int = 0;
var n:int = form.numElements;
for (it; it < n; it++)
{
var formItemsArray:Array = form.getElementAt(it) as Array;
}
for( var i:int = 0; i < formItemsArray.length; i++){
if(formItemsArray[i].className == "FormItem"){
var formItem:FormItem = formItemsArray[i] as FormItem;
formItem.setStyle("labelWidth", width);
}
}
}
You’ll need to use
form.numElementsand iterate. Each element is reachable viaform.getElementAt( iterator ).