A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: AS2 Open new window

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    12

    AS2 Open new window

    I'm sorry to have to ask this as I know there are many tutorials out there on how to do this, but using as2 how can I open a new browser window when a button is clicked, that is sized to specific dimensions?

    The reason I ask is because every bit of code I tried to use did absolutely nothing, when I clicked on the button nothing happened. This is the code I'm trying to use at the moment

    Code:
    getURL ("javascript:NewWindow=window.open('master.html','Title','width=1024,height=614,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");
    I'm using flash CS4, flash player 10 and actionscript 2
    Please Help!
    Last edited by AffinityFX; 03-02-2009 at 05:44 PM.

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Opening a new window in flash, in many cases, won't work until you upload it to a server.. It's some sort of security messure that probably makes perfect sense, but it's a bit of a hassle. If im not mistaken, the code you posted will be blocked by most popup blockers too. best to add a popup javascript to your html, then call that from our button in flash. Try uploading it first though.
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    Junior Member
    Join Date
    Jun 2007
    Posts
    12
    Thanks for responding,

    The problem is the website for which this code is for won't be uploaded to a web server, it will only ever be viewed locally. Does this mean that there isn't any possible way of achieving this?

  4. #4
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Will it only be viewed on one computer? You can go to the adobe site and set your local folder as 'safe' if so, if not, find a javascript that gets embedded in your html then call that from flash, should work.
    Evolve Designs Interactive Media
    the natural selection

  5. #5
    Junior Member
    Join Date
    Jun 2007
    Posts
    12
    Well it more than likely will be viewed on more than one computer and it won't be possible to change the settings on each of them. I've tried to embed the javascript code within the html file, but locally this still doesn't work. However when I uploaded the site to my web server it did work. So is then any way to achieve this same result locally without changing the settings of the player? I have seen it done before locally at http://www.kirupa.com/developer/flash5/newwindow.htm, but this was done with AS1.

    Thanks

  6. #6
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Yup that kirupa one is pretty much what i mean by creating your popup function in java embeded in your html then call that from flash. The only difference for as2 is that you'd write it like:

    PHP Code:
    getURL("javascript:Launch('http://www.kirupa.com/kirupa.htm')"); 
    Evolve Designs Interactive Media
    the natural selection

  7. #7
    Junior Member
    Join Date
    Jun 2007
    Posts
    12
    Well the code you just gave me works when it's hosted on my web server, but not when it's run locally. Do you know why this code would work using AS1 locally but not using AS2?

    Thanks for all your help

  8. #8
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    hmm.. maybe cause it's calling a remote page? try loading your local page if you haven't already. so the as1 works locally? hmm
    Evolve Designs Interactive Media
    the natural selection

  9. #9
    Junior Member
    Join Date
    Jun 2007
    Posts
    12
    The page I'm trying to load is local, it's in the same directory as the swf file itself (it still doesn't work if I try to load Google).

    Yeah when I downloaded the code from Kirupa it worked fine locally. But the same code in AS2 doesn't seem to work. I may be doing something wrong, but I don't see how, as the code is pretty much identical.

  10. #10
    Member
    Join Date
    Jun 2006
    Location
    San Francisco
    Posts
    56
    Did you fix this? I have the same problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center