2 Replies Latest reply on Jul 31, 2009 9:01 AM by Gregory Lafrance

    Want to design a generic custom Message

    Zolotoj Level 3

      I want to have a generic mechanism of showing custom messages. I have a common library where I want to keep most of code needed for that.

       

      Common library:

      public function customUserMessage(message:String, parent:Sprite):void
      {
      var message1:String = "";
      if (message.indexOf("%") != -1)
      {
      message1 = message.substring(0, message.indexOf("%")) + String.fromCharCode(13);
      message = message1 + " " + 
      message.substring(message.indexOf("%") + 1, message.length);
      }
      var alert:Alert = Alert.show(message, "Warning!", Alert.OK|Alert.CANCEL, parent, alertClickHandler, null);        
      PopUpManager.centerPopUp(alert);
      } 
      // Event handler function for displaying the selected Alert button.
      public function alertClickHandler(event:CloseEvent):Object 
      {
      return event.detail;
      }
      

      Implementation:

      customUserMessage(userMessage, this);
      

      At this point I would want to catch user's respond. How would I change my code?

       

      Thanks a bunch