How to scale the Stage to fit the screen?

Currtent code dosen't work very well. Any better solution? Thanks,
var videoHDWidth:Number = 1024;
var videoHDHeight:Number = 768;
var videoRegWidth:Number = 550;
var videoRegHeight:Number = 400;
// 3. Create an event handler to toggle full screen
// mode when a button is clicked.
function toggleFullScreen(event:MouseEvent):void {
    // Jump to full screen
    if( stage.displayState == StageDisplayState.NORMAL ) {
        // Set video to 100% size
        flvControl.setSize(videoHDWidth, videoHDHeight);
        // Position button
        // Activate hardware scaling based on HD state...
        stage.fullScreenSourceRect = new Rectangle(0, 0, videoHDWidth, videoHDHeight);
        stage.displayState = StageDisplayState.FULL_SCREEN;
    // Return to normal size
    else{
        // Set video to regular size
        flvControl.setSize(videoRegWidth, videoRegHeight);
        // Position button
        // Return to normal mode
        stage.displayState = StageDisplayState.NORMAL;
//fullscreen_btn.addEventListener(MouseEvent.CLICK, toggleFullScreen);
// 4. Resume normal mode if the Escape button is pressed during full screen
function resumeNormalMode(event:FullScreenEvent):void
    // The displayState is already 'normal' by the time this
    // event fires. This signals that the Escape button was clicked.
    if (stage.displayState == StageDisplayState.NORMAL)
        // Set video to regular size
        flvControl.setSize(videoRegWidth, videoRegHeight);
        // Position button ;
        // Return to normal mode
        stage.displayState = StageDisplayState.NORMAL;
stage.addEventListener(FullScreenEvent.FULL_SCREEN, resumeNormalMode);
// 5. Set video parametes
flvControl.align = VideoAlign.CENTER;
flvControl.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
flvControl.fullScreenTakeOver = false;

Error "mc is not defined for: mc.contextMenu = fullscreenCM;
I changed as:
this.contextMenu = fullscreenCM;
Run it without error but it dosen't work out for full screen issue. Thanks,
Refered from Exploring full-screen mode in Flash Player | Adobe Developer Connection
// functions to enter and leave full screen mode;
function goFullScreen(event:ContextMenuEvent):void
    stage.displayState = StageDisplayState.FULL_SCREEN;
// An alternate full-screen function that uses hardware scaling to display the upper left corner of the stage in full screen.
function goScaledFullScreen()
    var screenRectangle:Rectangle = new Rectangle(0,0,stage.stageWidth / 2,stage.stageHeight / 2);
    stage.fullScreenSourceRect = screenRectangle;
    stage.displayState = StageDisplayState.FULL_SCREEN;
function exitFullScreen(event:ContextMenuEvent):void
    stage.displayState = StageDisplayState.NORMAL;
// function to enable and disable the context menu items,
// based on what mode we are in.
function menuHandler(event:ContextMenuEvent):void
    if (stage.displayState == StageDisplayState.NORMAL)
        event.target.customItems[0].enabled = true;
        event.target.customItems[1].enabled = false;
    else
        event.target.customItems[0].enabled = false;
        event.target.customItems[1].enabled = true;
// create the context menu, remove the built-in items,
// and add our custom items
var fullscreenCM:ContextMenu = new ContextMenu();
fullscreenCM.addEventListener(ContextMenuEvent.MENU_SELECT, menuHandler);
fullscreenCM.hideBuiltInItems();
var fs:ContextMenuItem = new ContextMenuItem("Go Full Screen");
fs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goFullScreen);
fullscreenCM.customItems.push( fs );
var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen");
xfs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, exitFullScreen);
fullscreenCM.customItems.push( xfs );
// finally, attach the context menu to a movieclip
mc.contextMenu = fullscreenCM;  -->error

Similar Messages

  • How to scale my stage to fit smaller screens?

    I'd like to resize the whole stage (while keeping my width/height ratio) to fit smaller screens until it reaches its minimum dimensions (let's say 75% of the original size). I thought of using the css property "zoom" but nothing have worked yet. My default stage dimensions are set to 1024px by 728px.
    Thank you very much!

    It works great but it seems like we can't set a maximum width/height... I would like my stage to "grow" until it reaches its maximum size (1024 x 768) even if the screen is larger than those dimensions.

  • How do i set it to fit to screen to print the entire file?

    How do i set it to fit to screen to print the entire file?  I have a file that is smaller than 8.5x11 but it says it's larger and clipping will occur and when I print it, it does not fit the paper.  Ive even clicked the box that says Scale to Fit Paper Size and it's still giving me that message and cutting info off. 
    I also need to be able to size it by percentage so I can adjust it to fit into a pre made form Im working with.

    First, I am new to this forum and I was told by Adobe that I would get help from Adobe as well as other users here, so that's why I posted.  But nobody asked me for basic info about image dimensions and printing sizes.  I never claimed to be an expert, just a basic user of PS, which is why Im asking for help.  I've used this program for my basic needs which is probably 1/1000th of what PS is capable of, but it's what I've used and I've always had success doing what I needed to do with it. If you can help, I very much appreciate it but if you just want to slam me and say you don't believe what I say, then that's not really helpful. Since nobody else responded to this post with any offers for help, the info you seek is below.  If you have any thoughts on how to help, I greatly appreciate it.
    Im not sure how the image dimensions apply to my question at all but here they are: 3300x2550 with a 300 dpi resolution. 
    Im simply trying to get the program to allow me to fit the image to the paper Im printing and adjust it as necessary to make it fit a partially pre-printed form I need for work and in every PS version I've used that I can recall, it allowed that.  It certainly allowed it, using the same printers Im using now, in CS5.
    Also, you mentioned that the printer driver handles this but I can do this in every other program I have on this computer with the same printers, from Numbers (it's a Mac) to Preview to Mac Mail so why wouldn't it do the same thing in PS? That's what Im trying to find out here and with most software, I can pick up a phone or get on a one-on-one chat and get help, but apparently not with PS and since it's not a cheap program, I expected more.  I never needed to call for help before using this new version, so that's something I need to consider.
    Again, if you are able to help, I appreciate it. Thanks!

  • Can anyone explain me how to scale the image in canvas in flash builder 4.6

    Can anyone explain me how to scale the image in canvas in flash builder 4.6, Scaling of image in component , can i get some examples ..  it should set almost all size screen

  • How To Scale the Rulers and Object Dimensions

    Hello. I've been using Corel Xara for a long time - like, since '98 - and recently started using Illustrator CS3.
    In Xara, one can set the scale for rulers and objects. For example, I can set up the rulers for inches and then define a scale of, say, 1-in equals 300-ft. Once done, the ruler no longer displays inches; it displays the scale feet. And, when entering dimensions for objects or grid locations, I can use, for example, 650-ft and it will understand that I mean 2.1667-in.
    Is there any way to do the same sort of thing in Illustrator? I saw how to change the rulers to inches, millimeters, points, etc., but I have been unable to find how to scale the ruler to X:Y.
    Any info?
    Thanx!

    Short answer: No.
    Longer answer: To change the ruler measurments to a different predetermined system, simly control-click (Mac) or right-click (PC) on the rulers themselves. You can not set the application to auto-scale dimension like you describe. You can use math functions in dialog boxes though. So you could enter 600'*.125 for 600 ft times 1/8

  • How to reload the screen when changing languages in JavaFX 2?

    I'm beginner with javaFX and i need to change language of the screen. but i have no idea how to reload the screen when the language was changed. The application have a button where have the language available. I want just refresh screen when the user change language.
    Here is the start method to show the stage.
        @Override
        public void start(Stage stage) throws Exception
            this.stage = stage;
            Locale locale = Locale.getDefault();
            ResourceBundle rb = ResourceBundle.getBundle("resources/Label",locale);
            loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"),rb);
            root = (Parent)loader.load();
            FXMLDocumentController controller = (FXMLDocumentController) loader.getController();
            controller.setMain(this);
            scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
    here is the function to change the language(in the same class with start function),the rb is the new ResourceBundle:
        public void refresh(ResourceBundle rb)
              //change the language here
    1. I don't want to use the resourceBundle to get value in resource file and set label in scene one by one.like following:
    this.btnLabel.setText(rb.getString(key.test));
    2. I don't want to reload the scene,like following:
        public void refresh(ResourceBundle rb)
             try
                loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"),rb);
                root = (Parent)loader.load();
                scene.setRoot(root);
                FXMLDocumentController controller = (FXMLDocumentController) loader.getController();
                controller.setMain(this);
            catch(Exception err)
                err.printStackTrace();
    So do we have a solution to just set the resourceBundle and reload the scene easier?
    Thanks and best regards!

    Your option 2 (reload the FXML for the scene using the new resource bundle as a parameter), is the way this would normally be done and what I would recommend.
    Failing that, you could use option 1 of individually resetting the label text of labeled items (I don't really recommend this).
    Why don't you want to use option 2?
    Perhaps it is because there is some internal state of the UI which differs from the initial state when the the UI is first loaded (e.g. user has typed text in a text field and you want to preserve that).  If that's the case you will need to either go with your option 1 of individually resetting the label text of labeled items, or implement something which preserves the UI state and user data by saving it in memory or to disk, reloading the UI via the FXMLLoader (essentially your option 2), then restoring the UI state and user data to what it was before the language change.  Preserving and restoring the modified state seems complicated to me if you have a lot of state, so I wouldn't really advise this approach unless you really needed it.

  • How to clear the screen in java?

    Hi,
    How to clear the screen in java without using any loops?
    Thanks

    Just paint with your background color to let the old paintings vanish.

  • How to unlock the screen of my iphone to see photos in both ways vertical

    how to unlock the screen of my iphone to see my photos in both ways, vertical & horizontal ?

    Turn off Portrait Lock in Control Center.

  • How to set the screen size with nested Iview screen

    Can someone show me how to set the screen size with nested IView  screen.
    at the moment i only try it with trial and error untill it looks somewhat close. Is there a property in VC to set the size for Height and width.
    The same question is for the form. the form elements inside the form is easy but the actual form is still a challenge.

    Hi,
    Yes you are correct ,Still the Form and iview are not able to change thier Layout Structure using a Propery.
    it is available with VC7.1
    Govindu

  • How to determine the screen structure of the detail area of a screen...

    Hi all,
              How to determine the screen structure of the detail area of a screen?

    Hi,
    go to se38,
    loop at SCREEN.
    endloop.
    put the cursor on SCREEN and press F1, then u can seee it.
    Regards,
    Pavan
    Edited by: vishnu Pavan on Mar 23, 2009 11:03 AM

  • How to take the screen shot of my computer page by using Labview.... is there any funtions available in Labview?

    How to take the screen shot of my computer page by using Labview.... is there any funtions available in Labview?

    Another thread about this theme.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • How to call the screen in methods could u please explain

    hi,
    how to call the screen in methods could u please explain clearly with example

    HI ,
    CALL SCREEN - Call a screen
    Basic form
    CALL SCREEN scr.
    Addition:
    ... STARTING AT x1 y1 ... ENDING AT x2 y2
    Effect
    Calls the screen scr; scr is the number of a screen of the main program. You use SET SCREEN 0. or LEAVE SCREEN. to define the return from the CALL screen.
    Note
    Please consult Data Area and Modularization Unit Organization documentation as well.
    Addition
    ... STARTING AT x1 y1  ENDING AT x2 y2
    Effect
    The coordinates x1, y1 (start column and start line in the window) and x2, y2 (end column and end line in the window) define the size and position of the CALL screen ("top left - bottom right"). Besides these coordinates, you can also see the contents of the primary window, but cannot perform any action there.
    Note
    If "ENDING AT ..." is not specified, suitable values are substituted for x2 and y2, taking into account the size of the called screen.
    Exceptions
    Non-Catchable Exceptions
    Cause: No further screen level (call screen); the maximum number of nested screen levels is restricted to 50 at present.
    Runtime Error: DYNP_TOO_MANY_CALL_SCREENS
    THX

  • How to record the screen in snow leopard ?

    how to record the screen in snow leopard ?

    Must I find it myself !
    Well you could try Google :-)
    I am unsure if you want a static image, or a movie recording of what you are doing on your screen.
    Images can be done using Command-Shift-3, Command-Shift-4, and Command-Shift-4-Space.
    3rd party utilities such as Skitch will allow you to annotate the image after you capture it.
    Making a movie of your screen activities can be done usng Applications -> Quicktime
    There are 3rd party screen records such as Snapz Pro, ScreenSteps, etc...
    And of course you can do a Google search.

  • How to capture the screen of the remote computer

    sir
    i need help for my project how to capture the screen of the remote
    system plaese give idea for doing the project

    Run a daemon on the remote computer which uses java.awt.Robot.

  • How to capture the screen and send it to attachment for that mail

    hi sir ,
         how to capture the screen shot and attach with that e-mail , whether it is possible or not ..
    Regards,
    kumar

    hi sir,
        i am asking about while creating the support message from help menu in sap..
    while creating the support message we have to give component , priority and text also .. after that click the send icon in that support desk message .. while clicking the send button the entire screen ( what  we have entered in that creen na ) i have to capture the screen ( it may be save in local file also )  after that it will attach into attachment and then send it to ...
    Regards,
    kumar

  • How to capture the screen for sending the mail

    dear sir,
                      How to capture the screen for sending the mail .. Is there any funtion module or anyother way ? .. How to do this .. Please tell me..
    Regards,
    Kumar

    dear sir,
    s thats my problem ?
    Regards,
    kumar

Maybe you are looking for

  • How to change the default login page

    Hi All, I got an issue with the login page. I want to display the Chinses as default, but now it's engish. I have changed the ICX: Language to Chinese at the site level, but it seems didn't take effect. And the parameter s_base_lang is still US in th

  • Swf is not working properly when upload to server

    I develop 1.swf which is having 3 buttons each one having anather .swf to call 2.swf, 3.swf respectively. This application is running perfectly on my PC, but While uploading the swf to server the 2.swf and 3.swf is not running. Can any one tell how t

  • Cbih82 "Accident details" - How to make older entries not editable

    Hello Experts, Is there a way in CBIH82 to set the "Accident details" long text field (under involved tab) in order that older entries cannot be modified? What I'd like would be like in maintenance notifications. No Changes to Existing Long Text. Whe

  • Leaving mapped idoc segments out of plain text output

    Hello all, I mapped a customer IDoc with one header and detail lines to a message maping with one header and detail lines. The value's in the header are used for variable substitution for the file name. The has to be writen as csv to a ftp server. I

  • Any layout suggestions for this?

    How can I place a JCheckBox and JButton components on the area beside the TabbedPane tabs (Top right corner position)? Final design should be like this image http://www.rejimani.com/backup/tabbed.jpg Any suggestions? Reji Mani