dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Stage Resize

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    4

    Stage Resize

    I have an xml slideshow which loads images into a movie container which displays full window...or fullscreen which is what this is designed for.

    When I load an image which is larger than the stage, the image goes off the screen. However, when I grab the corner of the Flash Window and do any kind of a resize, the image then goes full window and I see all the image.

    Is there a way using actionscript to make the same kind of call(s) that occurs when I manually resize the screen... not necessarily to resize the screen, but to get the container to refresh so that the larger image will resize to the size of the stage/window.

    BTW, _root.refresh() does not work and neither does mc2.refresh().

    Thanks.

    L.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I don't understand everything. For instance "the image then goes full window" ?

    Anyway, you can get the size of the Stage through AS.
    Stage.width and Stage.height will both return integers.
    And the onResize() function can triggger any events you want to happen when the window is resized. Example:
    code:
    myListener = new Object();
    myListener.onResize = function() {
    someFunction();
    someOtherFunction();
    };
    Stage.addListener(myListener);


  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    4
    Actually, I already do all this. What I need is a way for the stage which is, say, 640x480 to resize a movie container, filled with a jpeg image which is, say, 800x600.

    When I first load the jpeg, it extends out of the area of the stage...however, when I do a resize, it automatically then scales the 800x600 container to 640x480.

    What I'm looking to do is to not have to resize, but have the container automatically scale the 800x600 to 640x480. I have to set the stage to noScale so that I can use the Stage Listener to retrieve the height and width of the resized stage. However, this has meant that I had to create my own scaling functions for the jpeg image container. I've done this too. Everything works great with any resize, as long as the image in the container is smaller than 640x480. However, once I load an image that is larger than 640x480, I can't get the image itself to scale down to 640x480 unless the window is resized again. At that point, something triggers the stage to auto scale the image down in the container.

    Am I making sense?

    Thanks.

    Lance

  4. #4
    Senior Member
    Join Date
    Mar 2005
    Posts
    206
    You want to resize the Stage? Or the container clip holding the newly loaded jpg? I think your problem is easy to solve but your wording is a little unclear.

    If the problem is that the image comes in at 800x600 until you resize the entire stage...why not resize the image using a function call? Something like:
    Code:
    myImage.onLoadInit = function(){
    	if(this._width > 640 || this._height > 800){
    		this._width = 640;
    		this._height = 800;
    	}
    }

  5. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    4

    Here's a demo of my problem

    OK...I have created an example of my problem.

    First, I'm starting with an 852x480 stage. I have jpg images that I want to display upon the stage.

    When the stage is resized, I want to change the resolution of the images so that the jpg image is not scaled too much.

    I have created a mechanism that monitors the scaling of the flash movie and then loads the appropriate resolution image for display.

    OK...here's my problem:

    When you first load the flash movie, the display will be at 852x480, no matter what the size of the window. I am using noScale so that I can read the stage width and height in a listener.

    You will notice that when you resize the window even a little bit, the image then scales out to the full resolution of the flash window.

    If you continue to resize the window, you will see the number on the screen change from 480 to 720. Stop resizing at that point.

    If you click anywhere on the image, it will then load the next image. This image is a larger image at 1280x720, however, what shows is only the upper left corner of the image, what would be the equivalent of 852x480.

    If you resize the flash window even a little bit, flash resizes the image and it now displays completely and correctly.

    Question:

    Can whatever is occuring when you manually resize the window be created as an Actionscript command(s)?

    How can I get the image to rescale itself without having to manually resize the window?

    Here's the link to my demo: http://test.ongcorp.com/demo1.swf.


    Thanks for any help...

    Lance

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