Advanced Search

Results 1 to 10 of 10

Thread: Reacting to Stage Size

  1. #1
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Wink Reacting to Stage Size

    Hi...

    I'm creating a flash website which I want to have react to the size of the stage. So, I the following set of questions:

    (1) Can flash detect the stage size (say, after a browser resize) and increase the width of a particular movie clip in reaction? What about a mask?

    (2) Is there a way to position certain items on a particular frame in this same manner. (for example, if I want the header of my site to always be 30 px from the left border, how would I do that?)

    I imagine this can be done using Stage.width and Stage.height but I'm not quite sure how exactly. Notice that I only want it to change in the horizontal direction. Vertically, it should stay the same size.

    Thanks for the help.

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Stage.width and Stage.height are read only, and once you publish, the stage itself doesn't ever change sizes. The browser window does, so you can scale the movie accordingly, but this is rough.

    You may want to look into scaleMode and align...

    Code:
    Stage.scaleMode = "noScale";
    Stage.align = "LT";
    You can also add a listner and make a resize function:

    Code:
    Stage.scaleMode = "noScale";
    var myListener:Object = new Object ();
    myListener.onResize = function ()
    {
    mytext.text = "Stage size is now " + Stage.width + " by " + Stage.height;
    };
    Stage.addListener (myListener);
    For the positioning try something like the following:

    Code:
    Stage.align = "LT";
    Stage.scaleMode = "noScale";
    stageListener = {};
    stageListener.onResize = function(){
    header._y = Stage.height - header._height;
    header._x = Stage.width - header._width;
    }
    Stage.addListener(stageListener);
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Thanks Blizzard

    I saw this same tutorial as well and it works beautifully.

    It's a basic intutive manipulation of the "_x", "_y", "_width" and "_height" properties.

    Why do you say its rough?
    It looks pretty good and it adds a lot more flexiblity to my design.


    Thanks though

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You are welcome. It's rough because I prefer to use external means to do my resizing. Usually in html and CSS, it just helps me with productivity and speed.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by BLiZZaRD View Post
    You are welcome. It's rough because I prefer to use external means to do my resizing. Usually in html and CSS, it just helps me with productivity and speed.
    Is there any way to do this with html and css??

    You'd bascially have to put each design element into a seperate flash file wouldn't you??

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    No. between html, css, and javascript you can do anything in Flash. Depends on how hard and long you want to work on it.

    If you have what you are after and it works smooth I say stick with it. I just meant I prefer to go the other way with the design, but then again I don't do "whole sites" in Flash, just pieces, and my "expertise" (if there is such a thing) is more geared towards gaming.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Loaded movie stage size

    Is there a way I can have the...

    Stage.scaleMode = "exactFit";
    Stage.align = "LT";

    ...follow the movie as it is loaded into another movie? Is it a pathing problem?

    MOVIE 1 is loaded into MOVIE 2 which is loaded into MOVIE 3; MOVIE 1 is the one I want to keep the stage cropped to Exact Fit.

    See "Los Beer Bros. animation" at the following URL:

    http://parliamentbooks.com/

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Okay I see it. Which of the 3 movies is the animation?
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    Buckley (02-22-2008)

  10. #9
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD View Post
    Okay I see it. Which of the 3 movies is the animation?
    Thanks for the quick response. The animation is MOVIE 1.swf, loaded into MOVIE 2.swf , which is in turn loaded into MOVIE 3.swf

    In the animation, you'll notice that the barstools are "hanging" below the movie's dimension, because the barstools extend out onto the stage. And similarly, when I enlarged the art for a closeup shot, the need for cropping is even more obvious.

    Can't I --in MOVIE 3.swf--simply path to MOVIE1.swf loaded inside MOVIE2.swf and tell MOVIE1.swf's stage what to do?

  11. #10
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Just use a mask within Movie2 that is the size you want it to be

    Create a MC that is the exact size that you want Movie1 to be (for example purposes, let's call it "mask").
    Then in Movie2, add:

    movie1_mc.setMask("mask");

    As long as there are no other alignment issues, that will work.

  12. The Following User Says Thank You to Medyman For This Useful Post:

    Buckley (02-25-2008)

Bookmarks

Posting Permissions

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