Solved

Flex: problem with z-index

Posted on 2007-03-28
3
3,493 Views
Last Modified: 2009-12-01
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>
      <mx:FormItem label="Second field" required="true">
          <mx:TextInput id="xxx" width="200"/>
      </mx:FormItem>
      <mx:FormItem label="Third field" required="true">
          <mx:TextInput id="yyy" width="200"/>
      </mx:FormItem>
</mx:Form>                  
</mx:Application>

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:columns>
                  <mx:DataGridColumn dataField="col1"/>
                  <mx:DataGridColumn dataField="col2" visible="false"/>
            </mx:columns>
      </mx:DataGrid>
      <mx:Script>
            <![CDATA[
                  private function init():void {
                  b.y=a.y+a.height+1;
                  b.width=a.width;
                  parent.parent.setChildIndex(this.parent, parent.parent.numChildren - 1);
                  b.visible=true;
                  }
            ]]>
      </mx:Script>
</mx:Canvas>

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?
0
Comment
Question by:WebDvlp
3 Comments
 
LVL 5

Accepted Solution

by:
maclema earned 250 total points
Comment Utility
Try this:

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

- Matt
0
 
LVL 1

Assisted Solution

by:LadislavHajabacs
LadislavHajabacs earned 250 total points
Comment Utility
use
parent.parent.setChildIndex(this.parent, 0); in the suggestonBox

I think  Form behaves like HBox  0 index  is the top most object (vertically)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now