Why does adding a Flex DateChooser component throw an index out of bounds error?
- by Lo'
I'm facing an issue with the flex Application I'm currently working on.
When I open a pop-up using the 'createPopUp' method, I've got this index out of bounds error message :
RangeError: The supplied index is out of bounds. at
mx.core::FTETextField/getLineMetrics()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\FTETextField.as:2169]
at mx.core::UIFTETextField/get
baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\UIFTETextField.as:784]
at mx.controls::DateChooser/get
baselinePosition()[E:\dev\4.y\frameworks\projects\mx\src\mx\controls\DateChooser.as:994]
at spark.components::Group/get
baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:282]
at
spark.layouts::ConstraintLayout/parseElementConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1818]
at
spark.layouts::ConstraintLayout/parseConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1632]
at
spark.layouts::ConstraintLayout/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:414]
at
spark.components.supportClasses::GroupBase/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1148]
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at
mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at
spark.components::Group/validateSize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1012]
at
mx.managers::LayoutManager/validateClient()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:987]
at
mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:382]
at
mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:232]
at
mx.managers::PopUpManager$/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManager.as:139] at
views::AddProjects/loadAddProjectPopUp()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:184]
at
views::AddProjects/___AddProjects_Button1_click()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:838]
It seems that this error is caused by a "dateChooser" component in my popup :
<mx:DateChooser id="endDate"/>
When I comment this line, the error is no longer thrown and the popup loads correctly.
It's really weird because I didn't have this issue until this morning. All I did in the meantime was changing some layout-related stuff, but I don't see what is would have to do with this problem.
I don't get it...
Does anyone have a clue about how to fix this ? I need my DateChooser !
Thanks !
Laura
EDIT -
It seems that the problem is not caused by the DateChooser itself, but by the FormItem around it. Here's what my code looks like :
<Form width="100%">
[...]
<s:HGroup width="100%">
<s:FormItem label="Date de début">
<mx:DateChooser id="startDate"
firstDayOfWeek="1"/>
</s:FormItem>
<s:FormItem label="Date de fin">
<mx:DateChooser id="endDate"
firstDayOfWeek="1"/>
</s:FormItem>
</s:HGroup>
</Form>
If I remove the two FormItems, it works. Could anyone explain me why? Thanks !