My guess is that Application defaults to layout=vertical which means that
you're Application acts a little like a VBox.  Every time you add a tab it
must be indirectly calling updateDisplayList on the Application.  Set
layout=absolute and see if that fixes it.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

- Dan Freiman

On 09 Mar 2007 15:22:52 -0800, loc_tran106 <[EMAIL PROTECTED]> wrote:

  Hello All,

I have a problem that is bugging me big time. I'm writing a new
component for one of my applications which extends a titlewindow.

Each titlewindow contains a tabnavigator, and I programically
add/remove tabs to the tabnav. However, everytime I do that, the
titlewindow itself moves to the top of the screen and I have no clue why.

Can someone help explain to me what causes this problem? when you
click on "Add 3 more tabs" button?

TIA.

-Loc

Main Application:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; >
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;

private var tmpWindow:windowBug;

private function PopMeUp():void {
tmpWindow =
windowBug(PopUpManager.createPopUp(mainCanvas,windowBug,false));
PopUpManager.centerPopUp(tmpWindow);
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="100%" id="mainCanvas" >
<mx:Button click="PopMeUp()" label="Click Here" />
</mx:Canvas>
</mx:Application>

Component: (windowBug.mxml)

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical" width="400" height="300" title="Bug Test">
<mx:Script>
<![CDATA[
import mx.controls.Label;
import mx.containers.VBox;
import mx.events.*;

private function addMore():void {
var newVBox:VBox;
var newLabel:Label;
for (y=0; y<3; y++) {
newVBox = new VBox;
newVBox.label= "Added " + y;
newLabel = new Label;
newLabel.text = "Hello " + newVBox.label;
newVBox.addChild(newLabel);
newVBox.addEventListener("doSomething",doSomethingNow);
nav.addChild(newVBox);
}
}

private function doSomethingNow(event:Event):void {
trace ('nada');
}

]]>
</mx:Script>
<mx:Button click="addMore()" label="Add 3 More Tabs" />
<mx:TabNavigator id="nav">
<mx:VBox label="1" >
<mx:Label text="Hello 1" />
</mx:VBox>
<mx:VBox label="2" >
<mx:Label text="Hello 2" />
</mx:VBox>
<mx:VBox label="3" >
<mx:Label text="Hello 3" />
</mx:VBox>
<mx:VBox label="4" >
<mx:Label text="Hello 4" />
</mx:VBox>
</mx:TabNavigator>
</mx:TitleWindow>

Reply via email to