Hello all,

 

I have a feeling that I’m missing something obvious, but how do you determine the x and y coordinates - relative to the root application - of an object that resides within a component that is used as a pop-up window?

 

The code below works perfectly if it resides in the root application: the list appears just to the right of the buttons. But when the same code is in a component that serves as a pop-up window, the list appears away up and to the left; i.e., the Flash player is taking the x and y coordinates of the button relative to the pop-up window, but using x and y coordinates relative to the root app to display the list.

 

What am I missing?

 

<mx:Model id="ap">

                        <projects>

                                    <item label="None" data="" />

                                    <item label="Mirkwood" data="" June 2005" />

                                    <item label="Loth Lorien" data="" August 2005" />

                                    <item label="Fangorn" data="" September 2005" />

                                    <item label="Dead Marshes" data="" March 2005" />

                                    <item label="Emyn Muil" data="" January 2006" />

                        </projects>

            </mx:Model>

            <mx:ArrayCollection id="projectList" source="{ap.projects.item}" />

            <mx:Script>

                        <![CDATA[

                                    import mx.managers.PopUpManager;

                                    import mx.controls.*;

                                    private var testList:mx.controls.List = new List();

            private function testListPopUp(caller:Object):void{

                        testList.dataProvider = projectList;

                        testList.x = caller.x+70;

                        testList.y = caller.y;

                        PopUpManager.addPopUp(testList,this,false);

            }

            private function testListRemove():void{

                        PopUpManager.removePopUp(testList);

            }

                        ]]>

            </mx:Script>

            <mx:Button id="test1" click="testListPopUp(test1);" label="show" x="100" y="100" />

            <mx:Button id="test2" click="testListRemove();" label="hide" x="100" y="125" />



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to