Solved

Flex: problem with z-index

Posted on 2007-03-28
3
3,497 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
ID: 18839875
Try this:

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

- Matt
0
 
LVL 1

Assisted Solution

by:LadislavHajabacs
LadislavHajabacs earned 250 total points
ID: 21687176
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
anti-download video publishing site? 6 612
Action Script commands 5 234
Flash Converter 8 113
Adobe Acrobat Pro: chasing the white background wallpaper dimensions 3 151
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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 load their YouTube profile onto Flash Media Live Encoder.
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.

920 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

18 Experts available now in Live!

Get 1:1 Help Now