1 Reply Latest reply on Jun 22, 2006 5:22 PM by LA_Flash_Guy

    PopUpManager in the UIComponent Class and events

    LA_Flash_Guy
      Can anyone shed some light on the PopUpManager in the UIComponent Class in Flash?
      I am working on a project in which everything inheirits from the UIComponent Class and I'm having a bit of trouble with paths to my movieClips.

      I am creating a popup in an MC Class which is called IMDevice.
      popAlert = PopUpManager.createPopUp (this, Window, true, { title : "Choose Instant Message Type", contentPath : "IMAlert", closeButton : false});
      popAlert.setSize (320, 350);
      popAlert.move (680, 405);
      popAlert.addEventListener("click",this);
      popAlert.addEventListener("change",this);

      It loads the MC Class IMAlert from the lib.
      That all works fine.

      However I'm I'm not getting events dispatched from IMAlert.

      I've tried adding a dispatchEvent in the eventHandler in IMAlert to address what I thought was a scoping issue

      _parent.dispatchEvent({type:"change"});

      But I don't receive anything in the parent MC.

      Any help would be appreciated.
        • 1. Re: PopUpManager in the UIComponent Class and events
          LA_Flash_Guy Level 1
          The mystery has been solved.
          2 things for anyone interested:

          #1 An MC that loads into a Window can be found at Window.content
          #2 You can't add the eventListener until the content has loaded completely. You
          can use the "complete" event that is dispatched when a Window is completely loaded.

          // this is all within a Class that extends UIComponent so event delegation isn't required
          popAlert = PopUpManager.createPopUp (this, Window, true, { title : "Choose Instant Message Type", contentPath : "IMAlert", closeButton : true});
          popAlert.setSize (320, 350);
          popAlert.move (680, 405);
          popAlert.addEventListener("complete", this);

          function handleEvent (evt : Object) : Void {

          var e = evt.event;
          var t = evt.target;

          if (e == "complete") {
          popAlert.content.addEventListener("change",this);
          }

          if (e == "change") {
          trace ('IMDevice.change target: ' + t);
          }
          }