A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: curious about this..

  1. #1
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115

    curious about this..

    ok,

    i was just surfing along and i seemed to notice a rather interesting flash site

    http://www.constructiondurable.com/indexflash.htm

    notice how the movie resizes and activates the scrollbar without opening a new page. The whole movie is set to 100% x 100% along with a html sroll="no" command. But they still managed to make the movie scrollable?

    I was thinking FS command and adjusting the Stage Object tools.

    anyone know how to approach this?

    thanks
    No one will ever know how much you try, exept your self.. so suprize them.

  2. #2
    Senior Member
    Join Date
    Feb 2002
    Location
    Lebanon
    Posts
    573
    simple.. he is using a javascript function to resize the flash object, and thus when the flash object is resized the html page scroll bars will work accordingly.. this is very smart.

    code:
    // javascript code
    function size(n)
    {
    if ((n != "100%") && (n < document.body.clientHeight)) {
    n = document.body.clientHeight;
    }
    window.document.getElementById('case').height = n;
    window.document.getElementById('tableau').height = n;
    }



    thanks for the link

  3. #3
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    Hmm thx i will test it.

    I have this one where the back ground is resized while the movies contents are left alone and while the dimensions are set to 100% x 100%

    for your code do i just call it at the point i want the browser window to resize?

    // the movieclip "backgroundwhole" to match the movies size
    while the rest of the contents are unharmed

    fscommand("fullscreen", "false");
    fscommand("allowscale", "false");
    Stage.scaleMode = "noScale";

    sizer = new Object();
    sizer.onResize = function() {
    _root.backgroundwhole._width = Stage.width;
    _root.backgroundwhole._height = Stage.height;
    _root.backgroundwhole._x = -((Stage.width-800)/2);
    _root.backgroundwhole._y = -((Stage.height-2000)/2);
    };
    Stage.addListener(sizer);[COLOR=skyblue]
    Last edited by FabulisoAfrikan; 08-30-2004 at 02:55 AM.
    No one will ever know how much you try, exept your self.. so suprize them.

  4. #4
    Senior Member
    Join Date
    Feb 2002
    Location
    Lebanon
    Posts
    573
    well, it is not "my" code, i took it from the site you gave me.

    but it seems that he is calling the javascript function whenever he needs to resize the flash FROM flash.

    so, to achive this, keep the code that you did to resize the background mc, it'll work whenever the stage is resized, but the stage has to be resized by javascript, so in any place in flash whenever your content changes you have to call the JS function like this:
    code:
    getURL("javascript:size(num)");
    // num is the height you want



    "java script" must be one word.

    that's it.
    Last edited by msaleh; 08-30-2004 at 05:13 AM.

  5. #5
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    code:
    // javascript code
    function size(n)
    {
    if ((n != "100%") && (n < document.body.clientHeight)) {
    n = document.body.clientHeight;
    }
    window.document.getElementById('case').height = n;
    window.document.getElementById('tableau').height = n;
    }



    so the above code i add in the actions panel as the main code

    and the code below i put anywhere when iwant to resize?

    code:

    getURL("java script:size(num)");
    // num is the height you want

    No one will ever know how much you try, exept your self.. so suprize them.

  6. #6
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    right?
    No one will ever know how much you try, exept your self.. so suprize them.

  7. #7
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    not to put a damper on this, and im far from one of the purist accessibility nuts, but i cant read a thing on that site - even if i did speak french. everything either so small that the character's can't be formed properly (i.e., scaled to less pixels than needed by each character), or a significant portion of the page isn't viewable on the screen and it has the horizontal scroll disabled. of course, i have screen res at 1024x768 instead of the larger viewing areas most tech ppl use, so maybe its ok for them.

  8. #8
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    and to answre the OP - javascript goes between the head tags of the html document that contains the embedded swf

    so in the html document

    Code:
    <html>
    <head>
    <script language="javascript">
    function size(n) {
    //stuff
    }
    </script>
    </head>
    <body>
    <object..  blah blah your swf file>
    </object>
    </body>
    </html>
    and in the swf you put the getURL actionscript whereever you want

  9. #9
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    lol yeah i cant read it either. but i was just curious about that technique. Thank you very much for your help. I understand now.
    No one will ever know how much you try, exept your self.. so suprize them.

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