A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Browser Zoom level reset

  1. #1
    Member
    Join Date
    Apr 2001
    Location
    Cape Town
    Posts
    99

    resolved [RESOLVED] Browser Zoom level reset

    I have created a very dynamic application but realised that if the Browser zoom level is not set to 100% the dynamic positioning of objects are misplaced. Could anyone help with some Flash AS3 JavaScript function to reset the Browser Zoom level to 100% every time user click on button?

    What I am basically doing is loading external objects into emty movieclips, these are positioned according to the stage width and height. As a test I created a textfield to display the stage width. When I zoom in and click on the buttons (loading new content) the displayed stage width stays the same.

    Any ideas?
    Last edited by eye4see; 07-04-2011 at 09:23 AM.

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Cape Town
    Posts
    99
    By the look of the number of views it seems like a lot of people have a problem with this. After a few days of struggle I came to this conclusion.

    There is no way to controll the Browser zoom level. You can however detect when the stage.stageWidth has changed and then call a javascript funtion to reset the stage. Another option is:
    stage.scaleMode = StageScaleMode.NO_SCALE;

    But I found the best sollution is to simply go with the flow and allow for scaling. I had some trouble with this as I position the objects every time using stage.stageWidth. Now even though when you track stage.stageWidth it will update every time you zoom in or out, never use the stage.stageWidth option on a button to position. Strange as it may seem the initial stage.stageWidth must be used. Therefore I created a variable to hold this value. But to make it just a bit more complex when I use stage.stageWidth to populate the variable I was forced to start the application in a window with 100% zoom. So this forced me to rather hardcode the variable according to the size of my swf. This way I am certain that at whatever zoom level the window is set, the value will stay the same.

    Hope this makes some sense and are helpfull to others.

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