要调整你的容器,以你的舞台宽度的20%,你可以简单地这样做:
你Resize
效果:
<s:Resize id="resizeShow" target="{fstContainer}"/>
然后为按钮:
<s:Button id="btn_resize" label="Resize" click="resizeShow.widthTo = stage.stageWidth/5; resizeShow.play();"/>
编辑:
位于2方式,是使用数据绑定,就像这样:
<s:Resize id="resizeShow" widthTo="{_20_percent}" target="{fstContainer}"/>
声明绑定VAR:
[Bindable] protected var _20_percent:Number;
然后,你可以将其值设置完成后您的应用程序的创建时,或者当它添加到舞台,...:
protected function on_addedToStage(event:Event):void
{
_20_percent = stage.stageWidth/5;
}
protected function on_creationComplete(event:FlexEvent):void
{
// here of course, as you know, the stage is not yet accessible
_20_percent = FlexGlobals.topLevelApplication.width/5;
}
和当然,在这里你只需要使用一个事件处理程序来设置值。
第3方式,是动态创建Resize
效果,当用户按调整大小按钮:
protected function btn_resize_onClick(event:MouseEvent):void
{
var resizeShow1:Resize = new Resize();
resizeShow1.target = fstContainer;
resizeShow1.widthTo = stage.stageWidth/5;
resizeShow1.play();
}
而且它是由你来决定,你比较喜欢的方式;)
希望可以帮助。
谢谢。但它不起作用。 – ketan
对不起。我的错误,我写错了调整大小的ID。非常感谢它的工作。有没有其他解决方案或者这是最好的解决方案? – ketan
@ketan编辑我的答案,看一看。 – akmozo