apache-royale

How do I get the Application Width/Height based on Browser Height/Width


I am trying to dynamically change the positioning of the Components on my app. Is there a way I can invoke a resize eventlistener every time the user changes the size of his/her browser window?


Solution

  • Yes, add BrowserResizeHandler as a bead to the application, and listen to 'sizeChanged' on the initialView.

    Something like this pseudo-code (not tested):

    <js:Application applicationComplete="{myView.addEventListener("sizeChanged", sizeChangedHandler)}>
    <js:beads>
    <js:BrowserResizeHandler/>
    </js:beads>
     <initialView>
       <MyView id="myView/>
     </initialView>
    </js:Application>