2 Replies Latest reply on Dec 8, 2008 3:43 AM by niksk

    How to Render the titlewindow.

    niksk
      How to render the components in Titlewindow?

      I mean by it, for one user title window contains the some radiobuttons and some combo boxes. But for other user the same titlewindow will open but with one Text Input and with one Button only.

      Please tell me how to use it.

      Thanks
        • 1. Re: How to Render the titlewindow.
          amol bhandwale

          here is a sample example.may be it helps u

          create SimpleTitleWindowExample.mxml component as ::

          <?xml version="1.0" encoding="utf-8"?>
          <!-- Simple custom MXML TitleWindow component.
          The TitleWindowApp application displays this component.
          You cannot run it independently. -->
          <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml"
          title="Title Window" x="168" y="86" status="active" showCloseButton="true" creationComplete="init()" close="PopUpManager.removePopUp(this);" borderAlpha="0.75">

          <mx:Script>
          <![CDATA[
          import mx.managers.PopUpManager;
          import mx.controls.Text;
          // A reference to the TextInput control in which to put the result.
          public var loginName:Text;
          // Event handler for the OK button.
          private function returnName():void {
          loginName.text="Name entered: " + userName.text;
          PopUpManager.removePopUp(this);
          }
          [Bindable] public var includeinlayoutFlag:Boolean;

          public function init():void
          {
          if(includeinlayoutFlag)
          {
          this.removeChild(H1);
          this.removeChild(H2);
          }
          else
          {
          this.removeChild(H3);
          this.removeChild(H4);
          }
          }
          ]]>
          </mx:Script>
          <mx:HBox id="H1">
          <mx:RadioButton label="Yes">
          </mx:RadioButton>
          <mx:RadioButton label="No">
          </mx:RadioButton>
          </mx:HBox>
          <mx:HBox id="H2">
          <mx:CheckBox label="yes">
          </mx:CheckBox>
          <mx:CheckBox label="NO">
          </mx:CheckBox>
          </mx:HBox>
          <mx:HBox id="H3">
          <mx:Label text="Enter Name: "/>
          <mx:TextInput id="userName" width="100%"/>
          </mx:HBox>
          <mx:HBox id="H4">
          <mx:Button label="OK" click="returnName();"/>
          <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/>
          </mx:HBox>
          </mx:TitleWindow>



          create a demo.mxml as and run it.

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"
          horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="20" >

          <mx:Script>
          <![CDATA[

          import mx.managers.PopUpManager;
          import mx.containers.TitleWindow;
          import flash.geom.Point;

          private var point1:Point = new Point();

          // Open the TitleWindow container.
          // Cast the return value of the createPopUp() method
          // to SimpleTitleWindowExample, the name of the
          // component containing the TitleWindow container.
          private function showWindow():void {
          var login:SimpleTitleWindowExample=SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true));

          // Calculate position of TitleWindow in Application's coordinates.
          point1.x=myButton.x;
          point1.y=myButton.y;
          point1=myButton.localToGlobal(point1);
          login.x=point1.x+25;
          login.y=point1.y+25;

          login.includeinlayoutFlag = false ;

          // Pass a reference to the TextInput control
          // to the TitleWindow container so that the
          // TitleWindow container can return data to the main application.
          login.loginName=returnedName;
          }
          ]]>
          </mx:Script>

          <mx:Panel title="TitleWindow Container" layout="vertical" color="0xffffff" borderAlpha="0.15"
          paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">

          <mx:Button id="myButton" color="0x323232" height="32" label="Click to open the TitleWindow container"
          click="showWindow();"/>

          <mx:Text id="returnedName" width="100%" color="0x323232" text="Waiting..."/>

          </mx:Panel>
          </mx:Application>

          thx.
          • 2. Re: How to Render the titlewindow.
            niksk Level 1
            Thanks Dear....

            It gave me a good idea.............

            Thanks a lot