Но когда я TextInput со своим скином пытаюсь позиционировать в скине родительского компонента, свойство measuredWidth у скина textInput-а высчитывается неверно

Код AS3:
package swiz.views.components.skins
{
import flash.events.Event;
import flash.geom.Rectangle;
import mx.core.DPIClassification;
import spark.skins.mobile.TextInputSkin;
public class TextInputSkin extends spark.skins.mobile.TextInputSkin
{
protected var _width:int;
protected var _height:int;
protected var paddingLR:int = 12;
protected var paddingTB:int = 1;
protected var guiSize:Rectangle = new Rectangle(0,0, 640,960);
protected var appSize:Rectangle;
protected var appScale:Number = 1;
protected var deviceSize:Rectangle;
public function TextInputSkin()
{
super();
setStyle("minWidth",0);
setStyle("borderVisible",false);
setStyle("paddingTop",1);
setStyle("paddingButtom",1);
setStyle("paddingLeft",0);
setStyle("paddingRight",0);
setStyle("contentBackgroundColor",0xffffff);
setStyle("contentBackgroundAlpha",0);
addEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
}
protected function addedToStageHandler(event:Event):void
{
_width = stage.stageWidth / 4;
_height = _width / 5.11;
// trace("addedToStage _width="+_width+" stage.stageWidth="+stage.stageWidth);
deviceSize = new Rectangle(0, 0, stage.fullScreenWidth, stage.fullScreenHeight);
appSize = guiSize.clone();
appScale = deviceSize.width / guiSize.width;
switch (applicationDPI)
{
case DPIClassification.DPI_640:
case DPIClassification.DPI_480:
{
// here can be small displays
if(appScale < .6)
{
// 240
textDisplay.setStyle("fontSize", 21);
promptDisplay.setStyle("fontSize", 21);
setStyle("paddingTop",2);
setStyle("paddingButtom",2);
}
else if(appScale>.5 && appScale<1.2)
{
//320
textDisplay.setStyle("fontSize", 32);
promptDisplay.setStyle("fontSize", 32);
setStyle("paddingTop",3);
setStyle("paddingButtom",3);
}
else
{
//480
//trace("480");
textDisplay.setStyle("fontSize", 47);
promptDisplay.setStyle("fontSize", 47);
setStyle("paddingTop",4);
setStyle("paddingButtom",4);
}
break;
}
case DPIClassification.DPI_320:
{
//trace("320");
textDisplay.setStyle("fontSize", 32);
promptDisplay.setStyle("fontSize", 32);
setStyle("paddingTop",3);
setStyle("paddingButtom",3);
break;
}
case DPIClassification.DPI_240:
{
//trace("240");
textDisplay.setStyle("fontSize", 21);
promptDisplay.setStyle("fontSize", 21);
setStyle("paddingTop",2);
setStyle("paddingButtom",2);
break;
}
default:
{
// default DPI_160
// here can be big displays
if(appScale < .6)
{
// LOW
textDisplay.setStyle("fontSize", 14);
promptDisplay.setStyle("fontSize", 14);
}
else if(appScale>.5 && appScale<1.2)
{
// MED
textDisplay.setStyle("fontSize", 21);
promptDisplay.setStyle("fontSize", 21);
setStyle("paddingTop",2);
setStyle("paddingButtom",2);
}
else
{
// HIGH
textDisplay.setStyle("fontSize", 32);
promptDisplay.setStyle("fontSize", 32);
setStyle("paddingTop",3);
setStyle("paddingButtom",3);
}
break;
}
}
textDisplay.commitStyles();
promptDisplay.commitStyles();
invalidateSize();
invalidateDisplayList();
}
override protected function measure():void
{
trace("text input measure _width="+_width+" paddingLeft="+getStyle("paddingLeft")+" diff="+(_width + getStyle("paddingLeft")*2));
measuredWidth = _width + getStyle("paddingLeft")*2;
measuredHeight = _height+ getStyle("paddingTop")*2;
trace("text input measuredWidth="+measuredWidth);
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
trace("TI UDL");
super.updateDisplayList(unscaledWidth, unscaledHeight);
setElementSize(textDisplay,_width + getStyle("paddingLeft")*2, _height + getStyle("paddingTop")*2);
setElementPosition(textDisplay,getStyle("paddingLeft"),getStyle("paddingTop"));
if(promptDisplay)
{
setElementSize(promptDisplay,_width + getStyle("paddingLeft")*2, _height + getStyle("paddingTop")*2);
setElementPosition(promptDisplay,getStyle("paddingLeft"),getStyle("paddingTop"));
}
graphics.clear();
graphics.lineStyle(1,0xb8c7c6);
graphics.beginFill(0xffffff);
graphics.drawRect(0,0,_width+getStyle("paddingLeft")*2,_height+getStyle("paddingTop")*4);
graphics.endFill();
}
}
}

Код AS3:
...
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
// place skin parts...
cityDropDownLabelTextWidth = getElementPreferredWidth(cityDropDownLabel);
cityDropDownLabelTextHeight = getElementPreferredHeight(cityDropDownLabel);
typeDropDownLabelTextWidth = getElementPreferredWidth(typeDropDownLabel);
typeDropDownLabelTextHeight = getElementPreferredHeight(typeDropDownLabel);
setElementSize(cityDropDownLabel, cityDropDownLabelTextWidth, cityDropDownLabelTextHeight);
setElementPosition(cityDropDownLabel,(_width - cityDropDown.measuredWidth)/2,0);
setElementPosition(cityDropDown,(_width - cityDropDown.measuredWidth)/2,gap + cityDropDownLabelTextHeight);
setElementSize(typeDropDownLabel, typeDropDownLabelTextWidth, typeDropDownLabelTextHeight);
setElementPosition(typeDropDownLabel,(_width - typeDropDown.measuredWidth)/2,gap*2 + cityDropDown.measuredHeight+cityDropDownLabelTextHeight);
setElementPosition(typeDropDown, (_width - typeDropDown.measuredWidth)/2, gap*3 + cityDropDown.measuredHeight+cityDropDownLabelTextHeight+typeDropDownLabelTextHeight);
trace("cityTextInput.measuredWidth="+cityTextInput.measuredWidth+" _width="+_width);
setElementPosition(cityTextInput,(_width - cityTextInput.measuredWidth)/2, gap*4 + cityDropDown.measuredHeight+cityDropDownLabelTextHeight+typeDropDownLabelTextHeight + typeDropDown.measuredHeight);
// позиционирование поля ввода
setElementPosition(searchButton, (_width - searchButton.measuredWidth)/2, gap*6 + cityDropDown.measuredHeight+cityDropDownLabelTextHeight+typeDropDownLabelTextHeight + typeDropDown.measuredHeight+cityTextInput.measuredHeight);
}