3 Replies Latest reply on Aug 14, 2008 10:17 AM by vikceo

    Windowless Application

    vikceo Level 1
      Well I am trying to create a window less application.. But I should be able to move or resize my widget like the normal flex widget in normal mode.

      I used something like:
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="452" height="364" creationComplete="initMain();" layout="vertical" verticalScrollPolicy="auto"
      verticalGap="0" showTitleBar="false">
      <mx:VBox id="mainWindow" backgroundColor="#000000" width="100%" minHeight="40">
      some components..
      </mx:VBox>
      <mx:Panel id="mainPanel" width="100%" height="100%" headerHeight="0" opaqueBackground="true">
      some components
      </mx:Panel>
      </mx:WindowedApplication>

      code for initMain() is these 2 lines:{
      mainWindow.addEventListener( MouseEvent.MOUSE_DOWN, onStartMove );
      mainPanel.addEventListener(MouseEvent.MOUSE_DOWN, onStartResize); }

      Now, if i press down my mouse anywhere in the mainPanel and drag I can resize my widget. This is obvious as per what i did above. But, I want to resize enable only if some do it from the border of the panel.

      How to achieve this...?
        • 1. Re: Windowless Application
          TheNut007
          You need to break your algorithm up.

          1) First listen for the mouse down event. Using the (x,y) values of the pointer provided in the event passed to your listener.

          2) Determine whether or not that mouse pointer falls along a specific box-region in your panel. You know the panel's (x,y) coordinate and its width and height, so just calculate a box-region at the bottom right of the panel. If the pointer falls in that region, set a member variable flag to indicate that resizing is enabled. Also, record the (x,y) value of the pointer at this moment in another member variable.

          3) Add another listener for the mouse move event. If the resizing flag is set, then resize the window based on the difference between the new mouse cursor position and the one you recorded down in step 1.
          • 2. Re: Windowless Application
            vikceo Level 1
            since i am a beginner so do u have any code sample to do what you told?
            • 3. Re: Windowless Application
              vikceo Level 1
              never mind I put some extra efforts and was able to achieve so...