Solved

Flex: problem with z-index

Posted on 2007-03-28
3
3,523 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

729 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