A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: 100 percent in Browser

  1. #1
    Senior Member
    Join Date
    Apr 2005
    Posts
    467

    100 percent in Browser

    I was wondering if you can set the stage size at 100 percent when the swf is embeded in a browser, the way you can do it localy in the flash player.

    That means that you see the stage at its own size + you have all the area surrounding that stage which is part of the same swf.

    Basicaly I've got my main area (800/600 px) that people can use for those who have small resolution screen, and I want to let the possibility for those who'll see it on a 1024/768, to have the main area still on 800/600 + access on the outer zone around that 800/600 to play with, for instance to drag and drop things out of the main area.

    Kinda impossible to explain really, so I attached a gfx to get it clearer.
    So basicaly I want to have the "100 %" feature when swf is in a browser.

    I aint asking for my swf to scale 100% with the browser (I know how to do that), but for the main stage of my flash to remain at 800/600 while - if browser maximize - the zone around is still my swf.

    Actually I am even wondering if its possible whithin a browser.

    Jee
    Attached Images Attached Images
    Hope nobody knows I am still on Flash 5
    ______________________________________
    All artists are prepared to suffer for their work
    but why are so few prepared to learn to draw?(Banksy)

  2. #2
    Senior Member olias32's Avatar
    Join Date
    Jan 2003
    Location
    Romania
    Posts
    126
    i had the same problem. its not easy to do because its not just flash, its also some HTML code.

    check out www.improvizati.ro (its a site i made that does this)

    in the flash timeline you have to use on a frame:
    Code:
    fscommand("allowscale", false);
    fscommand("fullscreen", false);
    and then in the HTML, inside the flash OBJECT tags, add (or modify if the properties are there already) the next code:
    Code:
    WIDTH="100%" 
    HEIGHT="100%" 
    ALIGN=""
    next, lower down (along with the other param name tags that are already there):
    Code:
     <PARAM NAME=scale VALUE=noscale>
     <PARAM NAME=salign VALUE=LT>
    and also lower:
    Code:
    scale=noscale 
    salign=LT 
    WIDTH="100%" 
    HEIGHT="100%" 
    ALIGN=""
    make sure you have them just right, or it will not work.
    in case you dont understand, just view the source on my page and you'll get it

    Now the swf will expand its borders to fit the window, without scaling its content.
    PS be sure you dont put your flash inside a table with fixed width, as this will not allow it to expand.

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Posts
    467
    Very nice one Olias32.

    here's the result: http://www.whatif.ie/shandon/

    it's still a work in progress, so lot of things still to be loaded/optimized/finished.

    No table allow here, so can I get the swf to be centre horizontaly and verticaly with this technique?

    I have tried: ALIGN="middle" but it stay stuck on the top left.
    Hope nobody knows I am still on Flash 5
    ______________________________________
    All artists are prepared to suffer for their work
    but why are so few prepared to learn to draw?(Banksy)

  4. #4
    Senior Member olias32's Avatar
    Join Date
    Jan 2003
    Location
    Romania
    Posts
    126
    centering is done from flash.
    you have to add this to the first frame of your movie

    Code:
    function center() {
      center the content;
    }
    
    center();
    
    myinterobj = {};
    myinterobj.onResize = center();
    
    Stage.addListener(myinterobj);
    ok, and now to explain:
    have all your content placed in a MC in the root of the flash (called for example main, and the function center should be something like:

    Code:
    function center() {
      main._x = (Stage.width - main._width) / 2
      main._y = (Stage.height - main._height) / 2
    }
    *dont know if this works with _root as the MC to center. worth a try. (like _root.x = ..etc)

    next i call the function once, to make sure the content is centered when the flash is opened the first time.

    last i make a listener which centers the flash content (the MC main)everytime the window is resized.
    hope it helps

    cheers

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Posts
    467
    which version of flash do I need for that?
    Hope nobody knows I am still on Flash 5
    ______________________________________
    All artists are prepared to suffer for their work
    but why are so few prepared to learn to draw?(Banksy)

  6. #6
    Senior Member olias32's Avatar
    Join Date
    Jan 2003
    Location
    Romania
    Posts
    126
    well i did it first on flash mx last year.
    and recently i switched to flash 8, and it still works.

    dont know about flash 5 though... did you try it and it didn't work?
    if so, i'll try setting my export options for flash 5 and see how it behaves

    cheers

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