Flex: problem with z-index

I have a problem setting the z-index in Flex.

This is my main file:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:v="components.*">
<mx:Form id="indiForm" width="100%">
      <mx:FormItem label="First field" required="true">
          <v:SuggestionBox id="indi_address2" width="200"/>
      <mx:FormItem label="Second field" required="true">
          <mx:TextInput id="xxx" width="200"/>
      <mx:FormItem label="Third field" required="true">
          <mx:TextInput id="yyy" width="200"/>

And this is SuggestionBox.mxml (which sits in the components directory):

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:TextInput id="a" width="100%" keyUp="init();"/>
      <mx:DataGrid id="b" visible="false" showHeaders="false" includeInLayout="false" maxHeight="100" minHeight="15" >
                  <mx:DataGridColumn dataField="col1"/>
                  <mx:DataGridColumn dataField="col2" visible="false"/>
                  private function init():void {
                  parent.parent.setChildIndex(this.parent, parent.parent.numChildren - 1);

What happens is that as soon as I start typing, the field moves below all other fields. What I want is that the suggestion-datagrid moves ON TOP of the other fields (a higher Z-index). What am I doing wrong?
Who is Participating?
maclemaConnect With a Mentor Commented:
Try this:

parent.parent.setChildIndex(this.parent, parent.parent.numChildren);

- Matt
LadislavHajabacsConnect With a Mentor Commented:
parent.parent.setChildIndex(this.parent, 0); in the suggestonBox

I think  Form behaves like HBox  0 index  is the top most object (vertically)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.