我想解決一個具體問題,我使用PopUpManager在Flex中進行了定位。基本上我想創建一個彈出窗口,它將與父容器一起滾動 - 這是必要的,因爲父容器很大,並且如果用戶的瀏覽器窗口不夠大(大多數情況下會是這種情況) - 他們將不得不使用容器的滾動條向下滾動。問題在於彈出窗口相對於另一個組件定位,並且需要保留該組件。彈性定位/滾動問題彈出
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.core.UITextField;
import mx.containers.TitleWindow;
import mx.managers.PopUpManager;
private function clickeroo(event:MouseEvent):void {
var popup:TitleWindow = new TitleWindow();
popup.width = 250;
popup.height = 300;
popup.title = "Example";
var tf:UITextField = new UITextField();
tf.wordWrap = true;
tf.width = popup.width - 30;
tf.text = "This window stays put and doesn't scroll when the hbox is scrolled (even with using the hbox as parent in the addPopUp method), I need the popup to be local to the HBox.";
popup.addChild(tf);
PopUpManager.addPopUp(popup, hbox, false);
PopUpManager.centerPopUp(popup);
}
]]>
</mx:Script>
<mx:HBox width="100%" height="2000" id="hbox">
<mx:Button label="Click Me" click="clickeroo(event)"/>
</mx:HBox>
</mx:Application>
任何人都可以給我指向正確的方向嗎?謝謝。
我很欣賞然而除去調用centerPopUp幫助還沒有做出區別(除了彈出不居中)。 – user284163 2010-04-09 17:09:23