Professional Web Applications Themes

dynamically obtaining movie width/height - Macromedia Flash Actionscript

is there a way to dynamically obtain the width/height of the movie (.swf) I am working in?...

Sponsored Links
  1. #1

    Default dynamically obtaining movie width/height

    is there a way to dynamically obtain the width/height of the movie (.swf) I am working in?
    Sponsored Links
    asiabackpacker Guest

  2. #2

    Default Re: dynamically obtaining movie width/height

    the stage has width and height properties that you can access. and each movieclip has _width and _height properties that you can access and change.
    kglad Guest

  3. #3

    Default Re: dynamically obtaining movie width/height

    i am looking for a way to access the width and height of the stage. Obviously
    there is no way to change this dynamically, but I just want to know if there is
    a way to access this dynamically, and if so how?

    asiabackpacker Guest

  4. #4

    Default Re: dynamically obtaining movie width/height

    as mentioned above you can use:

    stage.width;
    stage.height;
    kglad Guest

  5. #5

    Default Re: dynamically obtaining movie width/height

    well, that's easy enough-thanks.
    For some reason though, it comes up as four pixles under the actual stage dimensions, but I can definately work around that
    asiabackpacker Guest

  6. #6

    Default Re: dynamically obtaining movie width/height

    my bad. be sure to use Stage.height and Stage.width NOT stage with all lowercase letters.
    kglad Guest

  7. #7

    Default Re: dynamically obtaining movie width/height

    as in http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html?filter_flash=cs5&filter_flashplayer=10. 2&filter_air=2.6




    package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;

    public class StageExample extends Sprite {

    public function StageExample() {
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    stage.addEventListener(Event.ACTIVATE, activateHandler);
    stage.addEventListener(Event.RESIZE, resizeHandler);
    }

    private function activateHandler(event:Event):void {
    trace("activateHandler: " + event);
    }

    private function resizeHandler(event:Event):void {
    trace("resizeHandler: " + event);
    trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
    }
    }
    }
    Unregistered Guest

Similar Threads

  1. Dynamically changing Application height & width
    By Gajam in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: August 23rd, 04:05 PM
  2. ActionScripting Width, Height, X, and Y ?
    By simsjr in forum Macromedia Flash Actionscript
    Replies: 3
    Last Post: March 4th, 04:37 PM
  3. Stage width & height
    By migwia in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 11th, 11:45 AM
  4. Can't control height and width
    By Round Rectangle H & Width webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 3
    Last Post: October 9th, 09:31 PM
  5. Obtaining Width and Height for an Image
    By Sharlet in forum ASP
    Replies: 5
    Last Post: August 8th, 06:28 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139