6 Replies Latest reply: Jul 8, 2011 8:02 AM by bkrascal RSS

    making a popup window within flash as3

    bkrascal Community Member

      Hello Flash people, I suspect this is an extremely easy and simple question from a beginner...

       

      I need to make a pop up window effect within a flash movieclip.

       

      I read another discussion where someone got the following advice...

      --------------------------

       

      So you want it in actionscript 3?

       

      There are several ways to do it.

       

      One is to pull it out of the library the second is to place it on stage, set it visible = false via actionscript and set it visible = true when you click the button.

       

       

       

      popUp.visible = false;

       

      showBtn.addEventListener(MouseEvent.CLICK, ShowPopUP);

       

      function ShowPopUp(e:MouseEvent) {

       

           popUp.visible = true;

      }

       

      popUp.hideBtn.addEventListener(MousEvent.CLICK, HidePopUp);

       

      function HidePopUp(e:MouseEvent) {

           e.currentTarget.parent.visible = false;

      }

       

      This should work if you have the popUp placed on stage and you have, inside it, a button with an instance name "hideBtn". Also, of course you should name you popup window "popUp" and the trigger button "showBtn".

      ----------------------------------------

       

      So I tried this and but have the following compiler error...

       

      ReferenceError: Error #1065: Variable ShowPopUP is not defined.

      at default_fla::MainTimeline/default_fla::frame1()

      -----------
      So I guess the author of this answer assumed the reader knew how to define the variables before inserting this code.
      But I do not know how. can someone explain this to me?
      Thank you very much in advance..