Skip navigation
Currently Being Moderated

making a popup window within flash as3

Jul 8, 2011 4:55 AM

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..

 
Replies
  • Currently Being Moderated
    Jul 8, 2011 5:09 AM   in reply to bkrascal

    The problem may just be related to the following typo since the variable mentioned bythe error is not a variable, but the name of a function... note the spelling difference and fix it

     

    showBtn.addEventListener(MouseEvent.CLICK, ShowPopUP);

     

    function ShowPopUp

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 8, 2011 5:21 AM   in reply to bkrascal
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 8, 2011 6:12 AM   in reply to bkrascal

    That's another typo... should be MouseEvent.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points