Making a popup window within flash as3

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...
1. Dec 14, 2009 3:27 AM in response to: courtispeep
Re: simple pop-up with AS3? ...not using javascript
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..

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

Similar Messages

  • Whats the current deal with popup windows in flash?

    Hi There,
    whats the current deal with popup windows in flash? I'm
    trying to include popup windows in a site, and with IE7 (or
    whatever the newest version of IE is ..the firefox lookalike) the
    popups are not working at all, I have gone out a gotten other
    sample popup scripts and I encountering the same problem, which is
    the popups aren't working at all?
    Is this a problem with just IE7 or am i completely missing
    out on something here?
    any ideas would be really appreciated! or if anyone has any
    scripts for sizeable popup windows that work on IE7 i would really
    appreciate it. thanks
    :}

    well i have used a couple of different attempts. I have used
    code generated by this:
    http://www.flash-db.com/PopUp/
    on (release) {
    getURL
    ("javascript:NewWindow=window.open('pants.html','newWin','width=200,height=50,left=0,top= 0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
    void(0);");
    I have also tried a couple of other tutorials from
    http://www.kirupa.com
    link;
    http://www.kirupa.com/kirupa.htm'
    and I used the javascript supplied and had no luck (I
    embedded the html etc) ... i have tried about 5 other tutorials and
    I've got to the point where I'm wondering is the problem based
    around by browser, I only using IE7 and have no ther browser. I'm
    using FlashMX 2004. all the example files .fla and swfs i have
    downloaded aren't working either so I'm totaly scartching my head
    at this point...
    any ideas where i'm going wrong here? any help very much
    appreciated
    :}

  • How can I allow popup window within secured site?

    How can I allow popup window wlthin NWA People.com(secured site)?
    Ineed to see Access.

    You can allow pop-ups in Safari via Settings > Safari > Block Pop-Ups set 'off'

  • Opening a popup window from flash

    Hi, I'm about to lose it--I've tried everything and nothing
    seems to work! What I'm trying to do is open a pop-up window from a
    swf that needs to have a certain height and width and no nav bar.
    I've tried several techniques including putting javascript in the
    containing html file and having nothing in the HTML file. If anyone
    has any idea please let me know, thanks!

    artboy_sf,
    > Hi, I'm about to lose it--I've tried everything and
    nothing seems
    > to work! What I'm trying to do is open a pop-up window
    from
    > a swf that needs to have a certain height and width and
    no nav bar.
    I wonder if you're testing your efforts from the Flash
    authoring tool.
    With the Flash Player security sandbox, lately, you'll have
    to upload to a
    server to test in a browser.
    > I've tried several techniques including putting
    javascript in the
    > containing html file and having nothing in the HTML
    file. If
    > anyone has any idea please let me know, thanks!
    I wrote a tutorial on this -- both AS2 and AS3 -- not long
    ago for
    CommunityMX.com. It's a subscription site, and some of the
    articles are
    free, but this one isn't ... BUT ... you can sign up for a
    free trial
    subscription, check it out, then cancel if you like.
    http://www.communitymx.com/abstract.cfm?cid=F0639
    If I reference an article in my forum replies, I normally
    try to answer
    with a tutorial from my blog (free), or one of the free CMX
    articles, but I
    imagine you've already Googled around a bit. The CMX tutorial
    includes
    sample files, and you really won't be out any money.
    David Stiller
    Co-author, Foundation Flash CS3 for Designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • Open browser window within flash movie

    I've read several GetURL tutorials. They all open a new
    window. I want to open the URL within the flash movie.
    I would also like to specify the size and location. Just like
    a photo gallery, but instead of loading an image (or movieclip) I
    want it to load the URL. Can Flash do this? Can some brave and
    generous soul show me the way? Thanks!

    Let's make it a 100%. It isn't possible - the way you imagine
    at least it isn't.
    You could try to work around with css-layers and flash
    javascript communication, but this wont be very reliable. Cotting
    up you flash and using an i-frame would be more reliable, but also
    not really fun to do.

  • Problem closing popup window in flash player 10.0.32.18

    Hello,
    I'm new to the forum so please bear with me. I posted this in the actual "Flash" forum yesterday but I realized afterward that the ActionScript forum would be a better place to post the question (sorry about that). I'm a web designer but I don't use a lot of Flash. I'm sure this will change as time goes on. For now, I'm still using an old version of Flash MX on my Mac - Flash MX version 6. But I don't think this has anything to do with the problem I'm experiencing. I designed a flash animation for my wife's website back in 2004 and it has always worked perfectly up until installing the most recent Flash Player 10.0.32.18 just a few days ago. Here's the problem:
    On the main page of my wife's website, we have a special link called "view presentation". When you click on that link, a smaller, new browser window pops up in front of the main page (the window sits "over top" of the main page - a typical pop up window). Inside of this new pop up window is the flash animation (the actual swf file). Inside of the HTML code for the pop up window, I have coded the following javascript:
    function closeWin() {
       if (document.images) {
         self.close();
    The above script, closeWin() is called from a button called "Quit" that the user clicks on in the actual swf file inside of the pop up window. Here is the code from the swf ActionScript:
    on (release) {
        stopAllSounds();
        getURL("javascript:closeWin();", "_self");
    This has always worked perfectly right up to Flash Player version 10.0.22.87 - the window closed as soon as the user clicked on the button. But now, with the most recent Flash Player 10.0.32.18 installed, it no longer works. The pop up window no longer closes.
    Obviously, something has changed in this latest version of Flash Player 10.0.32.18 which is preventing this from working. Does anyone have any ideas on how I can fix this?
    Any help would be greatly appreciated. Thank you so much,
    Mike

    Well, thanks to your help - I got it solved. It's not the Security Update, it's not javascript, it's not the difference in flash versions, it's nothing in the ActionScript itself or any of the other things I/we thought it might have been. I looked really closely at your HTML code and compared it to mine and changed it so that it was almost exactly the same as what you had coded - here's what made the difference (I've bolded the changes so you can see the differences):
    old code:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="tour" width="600" height="450" align="top">
    <param name="movie" value ="tour.swf">
    <param name="quality" value ="high">
    <param name="bgcolor" value ="#ffffff">
    <embed name="tour" src="tour.swf" quality ="high" bgcolor ="#ffffff" width ="600" height ="450" align ="top" type ="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveconnect="true"></embed >
    </object >
    new code:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="600" height="450" id="tour" align="top">
    <param name="allowScriptAccess" value="sameDomain">
    <param name="movie" value="tour.swf">
    <param name="quality" value="high">
    <param name="bgcolor" value="#ffffff">
    <embed src="tour.swf" quality="high" bgcolor="#ffffff" width="600" height="450" name="tour" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
    </object>
    Now works perfectly - the pop up window closes every time (I also took out swLiveconnect="true" - not sure where that ever came from).
    I'm not exactly sure how the above changes could make it work but they did so I am thrilled that you were kind enough to help out. If you have any ideas as to what actually did make the difference, please let me know as I am very curious. Maybe is was the "codebase" line? Seems like adding in the "allowScriptAccess" also had some sort of effect.
    Thanks again,
    Mike

  • Launching a centred popup window in flash cs3

    I have followed the tutorial for doing this exact thing here:
    http://www.kirupa.com/developer/mx/centered_popup.htm
    Unfortunately this is for flash 8 and the whole way buttons
    work in flash has changed. How ould you go about replicating this
    in flash cs3?
    Thanks

    Ah yes, the javascript:function call in getURL.
    This change started happening in player 9, and was completely gone in player 10.
    This type of getURL call can easily be used to perform an injection attack on the users computer, and as such has been deemed a security risk and locked down.
    No fear, there is a new method to do this same thing. (New-er actually, as this class has existed since player 7)
    ExternalInterface.call(closeWin());
    Of course, you are using Flash MX, which can only publish to player 6 or lower.... so you may need the Flash-Javascript gateway scripts to do this: http://www.communitymx.com/content/article.cfm?cid=D7491

  • Dumb Q: problem with Find And Replace window in Flash 8

    Dear Flash Group,
    apologies if this is trivial, it's my first day using Flash.
    I downloaded a Flash project from
    http://www.flashorb.com/articles/benchmark_files/flash-benchmark.zip.
    This
    flash calls into a web service at localhost:8080. I used the
    'Find and
    Replace' window within Flash Professional 8 to locate the
    string
    'localhost:8080' and replaced it with plain 'localhost'.
    However, when I 'Debug the Movie' (Ctrl-Shift-Enter), it
    still tries to
    access port 8080! Obsiously, my replace command did not do
    what I thought it
    would do. I opened the FLA file in a binary editor, and saw 4
    more
    references to 8080, One if them in 'Properties' of a
    WebServicesConnector,
    but I cannot figure out how to find the other occurences.
    Checking on google, I see lots of people having similar
    problems, but no
    solutions
    Any ideas?
    Regards, /george
    PS. What do you guys do for code completion - is there a tool
    that would
    bring Flash on par with an professional IDE?

    george,
    > when I 'Debug the Movie' (Ctrl-Shift-Enter), it still
    > tries to access port 8080! Obsiously, my replace
    > command did not do what I thought it would do.
    Agreed.
    > I opened the FLA file in a binary editor, and saw 4
    > more references to 8080, One if them in 'Properties'
    > of a WebServicesConnector, but I cannot figure out
    > how to find the other occurences.
    Might they be the result of that WebServicesConnector
    reference?
    > Checking on google, I see lots of people having
    > similar problems, but no solutions
    That's really odd, actually. I'm on these boards every day,
    and I've
    never heard of this issue. I don't *think* the Find/Replace
    dialog visits
    panel contents, such as the Component Inspector panel, but I
    wouldn't swear
    to that.
    > What do you guys do for code completion - is there
    > a tool that would bring Flash on par with an
    professional IDE?
    Well, Flash is a professional IDE, of course. By definition,
    if you pay
    for something, you have acquired a professional product or
    service. I know
    what you mean, though. Flash itself rocks, but the Actions
    panel can be
    glaringly weak. Personally, I use SE|PY to edit ActionScript.
    http://www.sephiroth.it/python/sepy.php
    Sorry I can't speak to your other issue. :-/
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Can't get popup window to work, could use code help.

    This is the first time I've tried to open a popup window in
    flash, and I can't get it to work. The site I'm building has the
    navigation buttons contained in an animated movie clip. All of the
    navigation buttons work fine. But there's a link that the company
    wants me to add that opens a window to another site who hosts a
    video commercial for the company (it has to be a link to the other
    site, it can't be added directly to the customers site).
    The link the other company sent me is for javascript (I'll
    include it in the attached code), and the code works great if I
    just insert the javascript in the html. But I wanted to try and get
    the link in the Flash menu. I've tried several versions of the
    code, from applying it directly to the button to naming an instance
    of it and attaching the actionscript in the movie clip. When I'm
    done, I get two different problems. On my XP machine, I get a
    warning error about the flash trying to open something to another
    server. On my Vista machine, nothing happens at all.
    Anyway, I'm including the original javascript and several
    versions of the actionscript I've tried (with the actual site
    information replaced with "fakeurl.com", wasn't sure how these
    forums felt about including site info). Any help at all would be
    greatly appreciated. I've searched and searched for about a week,
    and I'm tempted to just do away with the Flash button and use a
    cheesy javascript button for this one link.
    Thanks!
    MoAtt

    In article <[email protected]>,
    [email protected] wrote:
    > All I want to do is have a Close Window link in my popup window that works.
    Select your text that you want to act as a trigger to close the window,
    just as if you were going to create a link.
    Then paste the following line of code into the link Inspector:
    javascript:self.close();
    That should do the trick.
    Cheers Martin

  • Can I add a Close button to a popup window?

    My RoboHelp 10 project has nested popup windows (that is, I can open a popup window within a popup window within a popup window). The problem is, when I close the popup window at the lowest level, all of them close simultaneously. This is not good for navigation, particularly if the user is following instructions in the popup window and needs to go back up one popup window level.
    Is there a method by which I can close each individual popup window, for example, by adding a Close button to them? In other words, can I change the format of the popup windows?
    Your help will be much appreciated in finding a solution to this problem because it is fundamental to the way we want our Help to function. If a solution can not be found, we may have to change to another product to produce our Help.

    Hi,
    You can create a close buton by creating a link as follows with the following address:
    javascript:self.close()
    But I'm not sure whether this will work correctly with RoboHelp generated popups.
    Another question: why would you want multiple popups? Wouldn't it be better to create a popup that can tthen redirect to another topic? Having lots of windows wil become very confusing very fast.
    Greet,
    Willam

  • Need help with as3 for popup window

    I am nearing the end of the semester in my Flash Animation class. I have learned very simple AS3 things, code snippets etc. I am trying to find the actionscript for coding a very simple popup window, but have not found a clue.
    Here's what I want to do...I have a white box with some type on the stage. When a person clicks on the white box, I want a popup to open that is larger, that will contain the same type but larger. That box will have an x so it can be dismissed. I don't want to do this in html, only in Flash CS5. I don't want a browser window, I just want a bigger version of the smaller box. I know how to build both boxes, just don't know how to write the code. I know there will be an on-click mouse event listener, and then I am lost.
    Can anyone help with the code I might use? It would be most appreciated.

    It would be something along the lines of... (using instance names relative to your description)...
    popup.visible = false;
    whiteBox.addEventListener(MouseEvent.CLICK, showPopup);
    function showPopup(evt:MouseEvent):void {
         popup.visible = true;
    popup.popupX.addEventListener(MouseEvent.CLICK, hidePopup);
    function hidePopup(evt:MouseEvent):void {
         popup.visible = false;

  • Popup window with javascript in flash

    Hi everyone ;)
    I wonder if there´s available some code/tutorial which
    would make a "javascript call" and pop up what could bring some
    content into a new window in actionscript 3. I have a actionscript
    2 code for popup window but obviously it´s not working on my
    website project because of the wrong flash type :| So do you know
    how to make these kinds of pop up windows in as3?
    http://flashden.net/files/42875/index.html

    i am now down to only 1 error. How the script looks and the
    only error generated are below.
    on (release) {
    getURL("javascript:newWindow=
    window.open('
    http://websitemedia.net/playground/ferrioni/sandbox/ferrioniaddress.html','popper1',
    'width=425,height=300,scrollbars,resizable');
    newWindow.focus(); void(0);");
    error below:
    **Error** Symbol=contact, layer=Layer 1, frame=1:Line 5:
    String literal was not properly terminated
    newWindow.focus(); void(0);");

  • Popup windows in front of fullscreen flash - help

    hi,
    I have and swf embedded into an aspx web page. I am using ExternalInterface.call to open windows using javascript
    Eeverthing is working fine when stage.displayState = "normal"
    However, all popup windows are diplaying behind the flash when stage.displayState = "fullScreen"; 
    Does full screen mode allow the popup windows to be displayed just like normal mode? if so, what is the trick?

    I am making the following call in flash when the user clicks on a button
    if (ExternalInterface.available)
              ExternalInterface.call("puIfno");
    puInfo is a Javascript function in my aspx web page, the function shows an embedded pop up object
    Here is the Javascript function
    function puInfo() {
        parent.pu.Show();
    Note: pu is an aspx popup object that is a aprt of my web site
    This all works fine when the flash is in normal mode but when in fullscreen mode all popup windows are showing behind the flash instead
    I even tried using the window.open function in my Javascript instead and that caused the fullscren to go to normal
    any help will be greatly apreciated
    Thanks

  • Creating a PDF report within a popup window

    bq. Hi, \\ Within my application i've a page which uses JasperReports to generate a simple PDF report within prerender(): \\ public void prerender() { \\ try { \\ this.planned_bar_tripsDataProvider1.refresh(); \\ if (this.planned_bar_tripsDataProvider1.cursorFirst()) { \\ getApplicationBean1().*jasperReport* \\ ("PlannedBarTripsReport", "application/pdf", \\ getSessionBean1().getPlanned_bar_tripsRowSet1(), null); \\ } \\ } catch (Exception ex) { \\ log("Exception generating report", ex);} \\ } \\ jasperReport() is taken from the Sun PDF tutorial (http://developers.sun.com/jscreator/learning/tutorials/2/reports.html) \\ Now, when this page is opened within the application (browser) window the PDF report successfully renders. \\ However, when the page is opened within a popup window, using the (onclick) Javascript function: \\ function generateReport() { \\ window.open('PlannedBarTripsReport.jsp') ; \\ window.event.returnValue = false; \\ } \\ the PDF report fails to render. The result is a brief pause followed by a blank popup. No exception. No Abobe embedded window. No clues as to what's gone wrong. \\ Any advice would be greatly appreciated. \\ Ta.

    Hi Venkatv and everyone.
    This is the link where I found about Including Dynamic Images in a Report.
    http://www.oracle.com/technetwork/testcontent/apexprnt2-otn-098981.html
    It's so easy and clear to do.
    Good Luck!!!
    Regards.
    Ayrem

  • When popup windows open in Encore I am unable to select within that window

    Encore 5.5, for instance. . . .I got to file, dynamic link, import sequence and a pop up window comes up.  I am unable to select anything within that popup window to tell encore where to find the files I need.  This is the case with ANY popup window when working within encore.
    HELP!!

    No idea in terms of Encore as such. No problems in other programs?
    Try another mouse? In another USB port if USB?
    I can confirm that in the new project window, for example, you cannot tab or arrow between fields. If your mouse can't select, you're stuck. Same for dynamic link.
    Did you use the cleaner tool when uninstalling?
    I am not sure if reinstalling Encore necessarily recreates the preferences file. I would try this in any event. "Hold down the Ctrl and Shift keys while choosing Start > Programs > Adobe Encore <version number>. Release the keys after several seconds. The application will not start at this point, but the preferences file will be deleted." The more complete instructions are here at #12:
    Troubleshoot damaged projects in Encore on Windows
    None of that will matter, of course, if it is a mouse/mouse driver issue.
    Just FYI, there are keyboard shortcuts in Encore, but the list is not accessed from within Encore. Go here:
    Encore Help | Using keyboard shortcuts

Maybe you are looking for