Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

making a popup window within flash as3

Community Beginner ,
Jul 08, 2011 Jul 08, 2011

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

TOPICS
ActionScript
13.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2011 Jul 08, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2011 Jul 08, 2011

Thank you for your fast reply Ned, Tried the correction you gave and got a new version of the error...

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

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

incredible....
So you were correct,.. but dont know how to proceed now..
Hakan just replied with an interesting solution that I think I can work with So Im going to give it a shot..
But would love to increase my understanding if you know what is still the problem with 'this' code.
I will go check out his solution also and let you know how it goes..
thank you very much!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2011 Jul 08, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 08, 2011 Jul 08, 2011
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2011 Jul 08, 2011

Hello and thank you for your reply!

Your code looks a bit like the there code.. But it seems to be a bit better. The other code also comes

with a com folder and .as files. And I think your code is all inclusive within the .fla.

I like that!

So going to try it now... I will let you know how it goes..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2011 Jul 08, 2011
LATEST

Hi again!

this code worked wonderfully!!!

Terrific  solution, simple and to the point!

thank you incredibly for your quick solution and help!!!

great weekend!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines