I'm working on some debugging panels for Flex and to teach me more
about events and Flex Layout.

I've created a that will descend through a container's children and
their children, etc. and make each screen element a different color
and create a tooltip showing each component's x and y values, width,
height, and name.

Now I'm trying to create a popup window the code below this paragraph.
I've set up a right-click mouse event that triggers this function. The
ShowContainer class is an ActionScript class I've created derived from
TitleWindow. When I get the parent object in the createPopup function
it shows the container i right-clicked on. In the ShowContainer class
though, when I access its parent property it is null. Also I get
multiple copies of the ShowContainer window since several levels of
containers or controls have this event registered. I tried calling the
stopPropogate and then the stopImmediatePropogate methods in the event
handler, but that didn't seem to work. What did I do wrong.

    protected function createPopup(event:MouseEvent):void {
      var showCont:ShowContainer = new ShowContainer();
      var parObj:DisplayObject = null;
      parObj = event.target as DisplayObject;
      if (null == parObj) {
        trace('DebugPanel.createPopup parObj == null');
        parObj = event.currentTarget as DisplayObject;
      }
      if (null == parObj) {
        trace('DebugPanel.createPopup parObj == null');
      }
      else {
        trace('DebugPanel.createPopup parObj == ' + parObj.toString());
      }

      PopUpManager.addPopUp(showCont, parObj, false);
    }


Reply via email to