Button on Click, loads a pdf in new window

Hello, I am trying find the correct as3 code to make a button on Click, open a pdf in a new window. I have tried different ways, but when I add the code not only does it give me errors, but it makes my swf flip through all the pages instead of stopping on load. It is fine before I enter the code for this button.
Just to let you know, this button is within a movie clip on the main stage. I really wanted it in a MC within another MC, but can't figure out where to put the code.
Should it go on the main timeline, where all the rest of the code is, or should it go within the MC?
Please help! Very frustrated with AS3.
Thanks!

This is all my code. At this point my MC moves through all my content pages. Before I entered the last code (last 3 lines) it worked fine. I'm sure I am missing something simple. With the last piece of code it also gave me the error "1120:access of undefined property TNT_pricelist09. I would imagine because I have to add the folder name to the file name?
Thanks for your help!
home_btn.addEventListener(MouseEvent.CLICK, homePage);
pricing_btn.addEventListener(MouseEvent.CLICK, pricingPage);
about_btn.addEventListener(MouseEvent.CLICK, aboutPage);
contact_btn.addEventListener(MouseEvent.CLICK, contactPage);
function homePage(e:MouseEvent):void
content_mc.gotoAndPlay("home");
function pricingPage(e:MouseEvent):void
content_mc.gotoAndPlay("pricing");
function aboutPage(e:MouseEvent):void
content_mc.gotoAndPlay("about");
function galleryPage(e:MouseEvent):void
content_mc.gotoAndPlay("gallery");
function contactPage(e:MouseEvent):void
content_mc.gotoAndPlay("contact");
content_mc.pricePDF_btn.addEventListener(MouseEvent.CLICK, openPDF);
function openPDF(e:MouseEvent):void
navigateToURL(URLRequest(TNT_pricelist09.pdf));

Similar Messages

  • Using firefox 14.0.1. Loading a link using right-click and "Open Link In New Window", results in new window opening but address bar does not show URL..

    Using firefox 14.0.1. Loading a link using right-click and "Open Link In New Window", results in new window opening but address bar does not show URL. However, if I right click on a link and select "Open Link In New Tab", the Tab shows URL in address bar. So it's working when it's a New Tab but not a New Window.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • My extra mouse button no longer opens tabs in a new window

    I have a Logitech Marble Mouse. It has two extra buttons. I use one for "back" and the other is set to "auto-scroll". For as long as I can remember when I clicked on a link with the "auto-scroll" button the link would open in a new window. Since I updated to Firefox 6.0.2 this behavior has changed. Nothing happens now when I click on a link with the "auto-scroll" button.

    Apparently there is an Incompatibility or Conflict Bug between Greasemonkey 0.9.10 and Tab Mix Plus.
    An update to Greasemonkey 0.9.11 should fix it
    * https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/
    Check and tell if its working.

  • Why when I click on a link a new window opens instead of a tab, this is new

    When I click on a link a new window opens instead of a new tab. This is new. I've gone into tools and checked my settings and nothing changes it. It annoys me.

    This issue can be caused by an extension that isn't working properly.<br>
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Everything I click on opens in a new window, How do i fix this?

    EVERYTHING i click on opens in a new window. even when checking email or whatever I click on the email a new window opens, then I click to go back to emails and a new windows opens. everything I do a new window opens it is super annoying. anyone have nay idea how to fix this?? I am really computer stupid in this department...HELP!!

    Under Preferences > Content > checkmark "Block pop-up windows"
    Under Preferences > Tabs > checkmark "Open new windows in a tab instead"
    That may not solve all your problems, but it should make it a lot less annoying.

  • Tab click unexpectedly pops out to new window

    When I click on a tab, every so often (maybe 2-3 times a session), it will unexpectedly pop out to a new window. This occurrence is not like the purposeful downward click to immediately open a new window with the tab, but it is very delayed. In fact when this happens, my mouse pointer instantly jumps to the bottom right of the screen and if I don't move the mouse, the window doesn't open. But, after I move my mouse for a second or two, the tab pops out to the new window. Seems really strange, and can't find an answer anywhere.

    Hello,
    please install this add-on and see if it remedies the problem:
    https://addons.mozilla.org/en-US/firefox/addon/bug489729-disable-detach-and-t/
    --Tobbi

  • Why does clicking a link open a new window with a spam site on it?

    Happens randomly I will click a link that I want open on new tab it opens but a random site will open in a new window. These sites that open are spam sites that I do not want. I have uninstalled deleted firefox and reinstalled it nothing is fixing this issue. My other computer has the same problem. Does not happen all the time its just random sometime i dont even have to click a link and a new window will open with dating sites poker sites just crap I did not want opened.

    Recomend getting adblock for firefox.
    if you still get unrelated links you should consider scanning for Malware on you computer (this could be an installed program or an extension). I would recommend Malwarebytes as it is somewhat free to use.

  • I cannot open a new browser window by double clicking Firefox icon or selecting NEW WINDOW from the file menu.

    I can open only 1 browser window and I can't open another or multiple windows by double clicking Firefox icon or selecting NEW WINDOW from the file menu.
    Looking forward to your earliest reply.
    Thanks and regards,
    Sheraz

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • I have a late 2011 Macbook and whenever I open any application it opens only the top menu bar and no viewer windows.I always have to click cmd n to open new windows and it is quite annoying.Does anyone know how to fix this issue? Thx

    I have a late 2011 Macbook and whenever I open any application it opens only the top menu bar and no viewer windows.I always have to click cmd n to open new windows and it is quite annoying.Does anyone know how to fix this issue? Thx

    You may have more of a chance getting a quicker answer here:
    https://discussions.apple.com/community/windows_software/windows_compatibility

  • Open link (PDF) in new window from WebHelp custom skin button

    This question relates to my work with FM>RH integration. But the task I'm trying to accomplish is something specifically done in RH with customization of WebHelp skins, so I'm posting in this forum. I'm running RH9 on Windows XP Pro.
    We have recently replaced WebWorks with RH and finally have the mapping files set up to generate Help from our FM source files. Celebration was short, because then we realized that our users wanted a PDF option. We haven't done any mapping to create PDFs from RH, and that seems kind of silly anyway, since we have superior PDF generation from the FM files.
    So I set about making a custom button in the header of a WebHelp skin that will link to a PDF. I accomplshed that work, but its behavior falls short of the functionality I'd like to see. Currently, you click on the button and it opens the PDF in the browser window of the Help system. I want it to open in a new window, so I can keep the experience clean for the users, separating Help and PDF. I don't know if this is possible.
    Here is where I am at. To create button I navigated to:
    Project Set-up/Skins/NEW SKIN/WebHelp Skin Editor/ Main/NEW BUTTON
    When I choose the edit icon to customize the new button, there is an option to choose Link or JavaScript. I got the PDF to open inside the Help browser by just using the Link option and specifying the PDF. I have tried to use the JavaScript option without success. My JS may be wrong, but when I choose inline JS option and place anything there, it turns all the navigation buttons to gobbledy ****. Specifying an external JS file doesn't work at all.
    Any direction or help would be appreciated.
    Thanks,
    Douglas

    I see one other shortcoming with this solution now that I've implemented it. Our Help follows the applictions through a convoluted path of development servers, amongst other strangeness with the way we deploy Help and PDF documentation. My concern is referencing a single URL/file on a server. Since we're moving things around, that doesn't really work well, we want the PDF to be with the Help system, if possible. Is there a way to reference the PDF as a relative link in the baggage files, so it will pull it from whatever server the Help system resides on without having to make changes?
    UPDATE:
    It seems if you place the PDF in the WebHelp folder and reference it as the JavaScript, the Help system automatically reats it as root folder and find it there. So, I think this is the solution to my question? However, this is a bit annoying, as it means you have to remember to manually place the file in the compiled Help system. I had earlier experimented with placing the PDF as a baggage file, but those don't seem to carry over when you compile Help. Is there any way to put the PDF in the Baggage Files and designate that it be included in compiled Help?

  • When clicking on PDF link new windows opens then closes

    Okay I have IE 7.0 and Reader 9.0. I am running a Breeze file and within the file there are links to PDF's, so the problem is when I click on the link the PDF seems to open in a new web tab but then suddenly disappears. I have co-workers with the same configuration and it works for them but then for others its the same error. Anyone have any idea as to what is going on? What is the soluton? Or where can I go to find it? Thanks.

    This should help:
    1. Go to: Tools > Options > Tabs
    2. There is a section at the top that says 'Open links that open in a new window in:' and then a drop-down menu
    3. In the drop-down menu, select the 'Current Tab' Option
    4. Click 'OK'
    '''If this was the answer you were looking for, please click 'Solved' -- Thanks.'''

  • Open Google clicks and PDFs in New Window

    When I Google something, then click on links, the links open in the same screen, and not in a new window.  This makes it hard to navigate backwards.
    Also, when I click on PDF link, the link opens in the browser window, and again, I lose the website that I was on.
    Is there a setting on my Mac that can open stuff in a new window?  I tried the Finder General command "open in a new window" but that did not help.
    JoAnn

    Hi,
    I'm using Safari and FireFox -- mostly Safari.
    I looked in Safari preferences, and can't tell what to change.  It says "New windows open with Homepage".  Do I change to "Empty Page"??  Also, I looked at FireFox preferences, but can't see what to change.
    Love your pic
    JoAnn

  • Opening PDF in new window

    Hi all
    We want to generate a pdf at runtime in new window on click of a button suppose 'Show PDF'. We have written following code using MVC module.
    In HANDLE_EVENT for the button we are calling a controller method say 'Preview_PDF' which is generating a pdf and it opens in a new window too.
    But at the same time we are getting blank screen or view from where the event is triggered. I want the parent view should remain undisturbed and pdf should open in new window. Please advice where am I going wrong.
    Code written is as follows
    this is a controller method
    method PREVIEW_OFFER_LETTER.
    DATA: cparam TYPE ssfctrlop,
          outop TYPE ssfcompop,
          fm_name TYPE rs38l_fnam,
          my_tabix TYPE sy-tabix,
          file_size TYPE i,
          bin_filesize TYPE i,
          l_pdf_xstring  type xstring,
          lt_lines       type table of tline,
          ls_line        type tline,
          l_pdf_len      type i,
          tab_otf_data TYPE ssfcrescl,
          tab_otf_final TYPE TABLE OF itcoo .
      outop-tdprinter = 'PDF1'.
      cparam-no_dialog  = 'X' .
      cparam-preview = space.
      cparam-getotf = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname = 'ZHRERF_OFFER'
    VARIANT = ' '
    DIRECT_CALL = ' '
      IMPORTING
      fm_name = fm_name
    EXCEPTIONS
      no_form = 1
      no_function_module = 2
      OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION fm_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
      control_parameters = cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
      output_options = outop
      user_settings = space
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
      job_output_info = tab_otf_data
    JOB_OUTPUT_OPTIONS =
    *TABLES
    *it_tab = itab[]
    EXCEPTIONS
      formatting_error = 1
      internal_error = 2
      send_error = 3
      user_canceled = 4
      OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *********appending the otf data into the final table*********************
    tab_otf_final[] = tab_otf_data-otfdata[].
    converting OTF data into pdf data**************************
    data : it_OTF type table of ITCOO.
    it_OTF[] = tab_otf_final[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
      MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = l_pdf_len
       BIN_FILE                    = l_pdf_xstring
      TABLES
        OTF                         = it_OTF
        LINES                       = lt_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      l_pdf_len = xstrlen( l_pdf_xstring ).
      data: cached_response type ref to if_http_response.
      create object cached_response type cl_http_response exporting add_c_msg = 1.
      response->set_data( data   = l_pdf_xstring
                            length = l_pdf_len ).
      cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                  value = 'application/pdf' ).
      cached_response->set_status( code = 200 reason = 'OK' ).
      cached_response->server_cache_expire_rel( expires_rel = 10 ).
      data: guid type guid_32,
            display_url TYPE STRING,
            value type string,
            extension type string.
            extension = 'pdf'.
      concatenate 'attachment; filename='
                        runtime->application_name
                        extension
                        into value.
      cached_response->set_header_field( name  = 'Content-Disposition'
                                  value = value ).
      CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
      CONCATENATE runtime->application_url '/' guid '.pdf' INTO display_url.
      cl_http_server=>server_cache_upload( url      = display_url
                                             response =    cached_response ).
      NAVIGATION->RESPONSE_COMPLETE( ).
    endmethod.
    Please advice

    Capture the generated url for the PDF document into a variable w_url and then use the client click event of the button SHOW PDF to open it in a separate window.
    something like this
    <htmlb:button id="btn1" onClientClick="window.open(w_url)"
    this should open your pdf in a new window.
    hope this helps.
    Cheers

  • JavaScript needed - open PDF in new window

    I'm creating an interactive PDF in InDesign CS5.
    This PDF contains a button I've made that links to another, separate, PDF file.
    This is all working fine - trouble is, when I click the button to open the second PDF file, the first PDF automatically closes.
    Is there any way to make the second PDF open in a new window, keeping the first PDF open?
    I've been told I need to add a JavaScript in Acrobat.
    Your help would be much appreciated!

    Thanks - we're definately heading in the right direction now!
    I'm not sure how to select "Open in: New Window" as specified.
    In the button properties, there doesn't seem to be this sort of option (see image below).
    Perhaps I'm looking in the wrong place?
    Also, I believe the link action is a "Open a file" type.

  • Page data does not load with goButton? (new window of identical page)

    Hi guys. I ran into a problem. Essentially, I need to print a .jsff page but before I do, I have to alter its format a little bit. The solution I decided to use was to create a new .jspx page containing almost the exact same content. I even copied the data bindings and everything. Finally, I created a goButton on my original page like so:
    <af:goButton text="Print as BOSSMON" destination="SubmitPrint.jspx?org.apache.myfaces.trinidad.agent.email=true"
                        targetFrame="_blank">
    </af:goButton>This opens my page nicely in the format I want. But...there is no data on the page! It just opens a frame of the page. Can someone help me resolve this?
    Otherwise, is there any other technique I could use to accomplish my goal?

    Hi guys. Thanks to everyone for their suggestions. I finally got a working solution, something totally different from the suggestions.
    My goal was to print a .jsff page nicely. But before I could do that, I needed to modify some data on the page. I also wanted to do this in as few clicks as possible. I tried the goButton technique but the binding data would not load. I couldnt figure out why.
    Nonetheless, I finally managed to make my own version (albeit, not that neat!). I accomplished this by essentially making a template which automatically opens in showprintablebehavior format. I tried to follow a bunch of online tutorials/blogs but nothing worked for me. Here are the steps I used:
    1) Creating a new .jspx page.
    2) Copy the entire source of the .jsff page (the one which needs to be printed) into our new template .jspx page. (do have to modify the beginning parts by adding <af:document> <af:form> etc)
    3) Create a pageDef for the template page and copy the entire pageDef as well (do have to change the name of the pagedef)
    4) Modify your print template to your liking.
    5) Add a taskflow rule that links the original .jsff page to the new template page
    6) Add a commandButton on the original .jsff page which opens this printing page in a new window (remember to use "dialog:....."). Here is mine:
    <af:commandButton text="Open Printer Friendly Version" id="printer_popup" action="dialog:edit_print" useWindow="true"
                                  windowEmbedStyle="window" inlineStyle="display:block;"
                                  windowHeight="100" windowWidth="100">
    </af:commandButton>7) Now, in the printing template page, add a command button which simply has the showprintablebehaviour tag within it as well as a client listener to invoke some javascript. Here is what I used:
    <af:commandButton text="Printer Page" id="sha_print">
        <af:clientListener method="do_loading" type="focus"/>
        <af:showPrintablePageBehavior/>
    </af:commandButton>8) In the beginning of this page, you will have an <af:document> tag. Modify it so it sets focus to our print button above when the page loads. Like so:
    <af:document id="d2" initialFocusId="sha_print">9) Now add a resource tag to your page which has the "do_loading" javascript method.
    <f:facet name="metaContainer">
        <af:resource type="javascript">
              function do_loading(event) {
                  var target = document.getElementById('sha_print');
                  target.click();
                  top.close();
                  //alert("got focus sir!");
        </af:resource>
    </f:facet>Thats it! What this does is when you click on the command button to open the printer template, our template page opens but as it opens, it automatically sets focus to the printer button using the document tag. The printer button has a listener which activates when it receives focus (in our case, as soon as the page loads). This listener invokes the javascript method, which progamatically clicks the printer button and closes this window. What your left with is a printer friendly page of your modified page!
    All the data is present there too!
    If anyone has any questions/comments, please do ask.

Maybe you are looking for