So I have this PopupManager, in my flex app, that creates a popup on
the main screen of the application, but I have an eventlistener set on
the main application, which calls a function that tells the Popup to
follow the x,y of a sprite a couple displayobjects deep in the
displaylist.

So a visual in words:

SpriteToFollow (aka ns:NodeSprite)
  SpriteToFollowHolder
    MainSpriteHolder
      Applcation/Stage 

So Popup once popped up follows SpriteToFollow.  My Popup has two
states min/max where min is 250px by 150px and max is 400px by 400px.

When I change states my popup jumps around on the stage. What I have
found is when changing min/max or max/min the Popup keeps jumping back
to where its x,y were when it was first created. Then a frame later it
jumps back to follow the SpriteToFollow.


Here is my code that creates and updates the Popup. Maybe someone can
help me understand why it keeps going back to where it started?

        public function creatLaunchSuperDetails( ns:NodeSprite ) :
SuperDetailCallout
                        {
                                if(sdc){removeStageFrameEventListener()};
                                if(sdc){PopUpManager.removePopUp(sdc)};
                                createSDC( ns );
                                PopUpManager.addPopUp(sdc, this, false);
                                return sdc;
                                        
                        }

private function createSDC(ns:NodeSprite) : void
                        {
                                _ns = ns;
                                sdc = new SuperDetailCallout();
                                var p:Point = ns.localToGlobal(new Point(0,0));
                                sdc.x = p.x;
                                sdc.y= p.y;
                                
                                    
                                    this.addEventListener(Event.ENTER_FRAME, 
handleEnterFrameEvent);
                                    
                                    if(sdc && _ns.data){
                                        var type:String = _ns.data.type != null 
? _ns.data.type : " ";
                                        var name:String = _ns.data.name != null 
? _ns.data.name : " ";
                                        sdc.title=String(name + " " +  type);
                                    }else{
                                        throw Error ("Nodes.data is " + 
_ns.data);
                                    }
                    
                    sdc.line1="Illegal download amount";
                    sdc.line2="offline";
                
                        }
                        
                        private function handleEnterFrameEvent(event:Event) : 
void
                        {
                                var pt:Point = new Point(_ns.x, _ns.y);
                pt = _ns.localToGlobal(new Point(0,0));
                                trace( pt.x, pt.y);
                                trace( 'x is ' + _ns.x + '  and y is ' + _ns.y);
                                sdc.move( pt.x, pt.y );

                        }




Reply via email to