A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [CS5] Possible to add _blank URL window dimensions to button?

  1. #1
    Member
    Join Date
    Oct 2005
    Posts
    39

    [CS5] Possible to add _blank URL window dimensions to button?

    Hey guys...I've just finished working on an extensive HD intro for my website, which is in 1280x720 resolution.

    At the moment, my site has a splash page with 3 buttons on it:
    B1) opens the site in fullscreen mode
    B2) opens the site in normal window mode
    B3) opens a new browser window linking to my intro

    I realize the irony of having to ask what seems like such a simple question, but after a few searches, so far I haven't turned up anything.

    Here's the AS code I'm using for my intro button:
    Actionscript Code:
    intro_btn.onRelease = function() {
        getURL("http://mysite.com/intro.swf", "_blank");
    };

    I'm wondering if there is a way to somehow specify in that code segment what dimensions I'd like the new window to have? I know this can be accomplished in JavaScript with something like this:

    Actionscript Code:
    <a href="javascript:void(0)"onclick="window.open('http://www.mysite.com/','linkname','height=1280, width=720,scrollbars=no')">intro</a>

    Can this somehow be done in AS? If so, can someone please let me know how I might go about doing it?

    Also, I've already tried putting the intro on it's own separate HTML page, but because of resolution and other background contrast issues, I've found that it undoubtedly looks best in a window that is resized to its specific dimensions, rather than having extra space around the edges, top, and bottom.

    Thanks in advance for any help regarding this issue!

  2. #2
    Senior Member
    Join Date
    Sep 2010
    Posts
    324
    Put this in the <head> of your html web page:
    Code:
    <script language="JavaScript"> 
    function openWin(url, w, h) 
    { 
    var winprop = "width=" + w + ",height=" + h; 
    openwin = window.open(url,'',winprop); 
    } 
    </script>
    and this in your button AS:
    Code:
    getURL ("JavaScript:openWin('http://www.citradingcards.com/olymarine/video_library/crab_fest.html', '475', '475')");
    adjust as needed for your own page.
    That being said, it's not the greatest idea in the world to use a set dimension like 1280 x 720 if you are trying to get the full screen effect. And you want to do this in HD?? Do you realize the bitrate or file size required to produce a quality display at that size?? You better have a very interesting preloader for it as well as a big "Skip Intro" button because once uploaded to your server, it may take your viewers quite awhile to download something that big.
    Drawbacks of set dimensions for full screen....for example, it's too large to fit on my 1024 wide monitor and too small to fill the screen on my 1680 monitor. Also not all 1280 monitors will display all 1280 pixels. So it will only fit a narrow range of monitors IF, the viewer happens to have the browser window maximized.
    If full browser display is your goal, you'ld be better off scaling the intro than giving it a fixed w/h. That way it will fill the browser regardless of the window dimensions. From an old post:
    Here are examples of different scaling parameters available in the Publish settings. You can also add these parameters directly in the html (<param name="scale" value="noscale"). All the examples replace the actual Flash dimensions with 100% for both width and height (width="100%" height="100%"). These examples use the old <object> and <embed> to illustrate the different ways to scale Flash. Once you understand how it works I’d recommend that you use swfobject to place the Flash in your final project.
    View the source code for each page to see the full code.

    http://www.cidigitalmedia.com/tutori...exact_fit.html

    "exactFit" scales the file to fit exactly within the confines of the screen, irregardless if the movie becomes consequently distorted. The original aspect ratio is not maintained. So round things are not round and squares are not square.

    http://www.cidigitalmedia.com/tutori...e/noScale.html

    "noScale" is the default setting, and causes the movie to be displayed at the originally designed dimensions.

    http://www.cidigitalmedia.com/tutori...no_border.html

    "noBorder" causes the movie to be scaled to what ever dimensions are needed to have no border surrounding the movie within the player, which consequently could result in some of the movie being cut off from view. In other words, the movie will maintain the original aspect ratio and will fill the screen completely. But if the movie has to be streched wider to fill both sides of the screen, it will also stretch taller, but then some of the top and the bottom of the movie may be cut off from view.

    http://www.cidigitalmedia.com/tutori.../show_all.html

    "showAll" scales the movie to the size of the screen (which could cause pixelation if the file contains raster information), the difference between showAll and exactFit is that showAll mantains initial movie size proportions. Because it maintains the original aspect ratio, there can be space to the sides or the top and bottom. But everything always shows and they are not distorted. But notice the photo in the center, it becomes pixilated at larger screen resolutions.

    The trickiest part of trying to go full screen is that it’s difficult to make the Flash wider without making it taller also, that is, to maintain the correct proportions or aspect ratio of everything on the stage. These methods are just simple scaling accomplished with html. There are also methods to dynamically scale the stage and it’s elements using Actionscript… but that’s a much more complex undertaking.
    Best of luck to ya on your project!
    Video Man

  3. #3
    Member
    Join Date
    Oct 2005
    Posts
    39
    Hey man, thanks a lot for your post; I didn't know I could use JS within my AS code like that...so I can use JS inside my .swf's AS code and have it communicate to the external JS code that's in my HTML page?

    I realize I didn't really clarify this before, and figure it's best to do now just in case this changes any of the advice you've given me: my site is completely Flash - it uses a Flash front-end (design) and accepts data from various .xml files in order to populate the content on its various pages (back-end). So as for the page layout of the site itself, I only have an index.php file that contains the code that embeds the main .swf file that is my entire site. Will the code you've provided me with still work in this case?

    Also, you've made some other good points which I'll try my best to address (more for my own self-assurance now that you've mentioned them, not to contradict you):

    -My idea for designing the intro in 1280x720 wasn't so much to achieve a fullscreen effect; in fact, that thought never actually crossed my mind...I simply wanted to design something in HD since I've never really taken on a high-resolution Flash/AS project and I figured this was as good an opportunity as any. I thought the size was appropriate for HD web standards and naturally didn't want anything larger because of the exact reasons you've mentioned

    -To answer your question about the preloader, yes, it exists, albeit it's probably not as "interesting" (as you said) as it could be ...and a Skip button is available, though the intro itself isn't immediately displayed when users visit the site - as I explained originally, the splash page for my site offers the user the option to enter the site (either in fullscreen or normal window mode), or to view the intro (in a new window). The way I see it, if they click the button to watch the intro, they ought to be willing to wait long enough for it to load

    -You certainly raise a good point about the potential for fullscreen issues, yet again, that wasn't my original intention with the dimensions I selected. However, I hadn't originally thought of people on monitors that may not support resolutions that high, and that you're absolutely right in that even one using 1280x1024 will still have vignetting around the edges...I guess my only excuse for that is that I've been using a dual-monitored widescreen HD setup (1680*1050 x2) for so many years now that I've come to the completely ignorant assumption that everyone is using widescreen monitors these days, which is obviously totally untrue.

    Still, if I want to stick with the resolution I'm using now for the intro, will the code you've provided still work as I'd like it to?

    Thanks again!

  4. #4
    Member
    Join Date
    Oct 2005
    Posts
    39
    Quick update: I tried out your code and it worked perfectly!

    I had to make a few adjustments in order for the new window to open in the center of the screen, as well as exclude certain toolbars, etc. but I wouldn't have known where to start without your help! Thanks again mate!

Tags for this Thread

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