我需要在列表中的第一项顶部弹出一个组件,它工作正常。问题是当我向下滚动滚动条时,弹出组件会改变位置。我想要的是流行音乐可以在第一时间修复。
问题:向下拖动滚动条时,弹出组件的位置会改变。我希望它保持相同的位置。
应用:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:popup="components.popup.*"
width="100%" height="100%">
<s:Scroller width="100%" height="100%">
<s:VGroup width="100%" height="100%">
<popup:OrderView width="100%" height="100%"/>
</s:VGroup>
</s:Scroller>
</s:Application>
订单视图:
<?xml version="1.0" encoding="utf-8"?>
<s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
gap="0">
<fx:Script>
<![CDATA[
import mx.containers.Panel;
import mx.managers.PopUpManager;
private var panel:Panel;
private function pop():void {
if(!panel) {
panel = new Panel();
panel.title = "I'm a pop";
panel.width = 150;
panel.height = 100;
}
var pos:Point = item1.localToGlobal(new Point(0,0));
panel.move(pos.x + 100, pos.y + 10);
PopUpManager.addPopUp(panel, parent as DisplayObject, false);
}
]]>
</fx:Script>
<s:SkinnableContainer id="item1" backgroundColor="#00ff00" width="600" height="200">
<s:Button label="Pop Window" click="pop()"/>
<s:Label text="item1...." left="300" top="100" color="#ffffff"/>
</s:SkinnableContainer>
<s:SkinnableContainer id="item2" backgroundColor="#0000ff" width="600" height="300">
<s:Label text="item2...." left="300" top="100" color="#ffffff"/>
</s:SkinnableContainer>
<s:SkinnableContainer id="item3" backgroundColor="#000000" width="600" height="300">
<s:Label text="item3...." left="300" top="100" color="#ffffff"/>
</s:SkinnableContainer>
<s:SkinnableContainer id="item4" backgroundColor="#ff0000" width="600" height="300">
<s:Label text="item4...." left="300" top="100" color="#ffffff"/>
</s:SkinnableContainer>
<s:SkinnableContainer id="item5" backgroundColor="#ee66ff" width="600" height="300">
<s:Label text="item5...." left="300" top="100" color="#ffffff"/>
</s:SkinnableContainer>
</s:VGroup>
第一次弹窗位置没问题
滚动后: