4 Replies Latest reply on Jan 28, 2010 9:29 PM by venkateshk

    seat selection based on the combo selected value

    venkateshk Level 1

      My application is as follows

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  xmlns:word="*" creationComplete="cc()"
          layout="absolute" backgroundColor="0xFFFFFF">
             
          <mx:Script>
              <![CDATA[
                  import mx.core.UIComponent;
                  import mx.rpc.events.ResultEvent;
                    import mx.core.Container;
                  import mx.controls.Alert;
                  import mx.controls.Label;
                  import mx.containers.Box;
                                  
                  [Embed(source='../assets/78skate.ttf',
                          fontName='myMyriadFont')]
                  private var font1:Class;
                 
                  private var boxes:Array = [
                    {hbox: "hb1", label: "A", num: 25, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb2", label: "B", num: 25, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb3", label: "C", num: 25, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb4", label: "D", num: 10, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb5", label: "E", num: 10, font: null, rotation: 0, direction: "vertical"}
                  ];
                             
                  private function getBox(boxHeightWidth:Number, boxLabel:String,
                    num:uint, textFont:String=null, boxRotation:Number = 0,
                    direction:String="horizontal"):Box{
                    var box:Box = new Box();
                    if(direction == "horizontal"){
                      box.width=boxHeightWidth;
                      box.height=25;               
                    }else{
                      box.height=boxHeightWidth;
                      box.width=25;               
                    }
                    box.setStyle("borderStyle","solid");
                    box.setStyle("borderColor","black");
                    box.setStyle("verticalAlign","middle");
                    box.setStyle("horizontalAlign","center");
                    var lab:Label = new Label();
                    lab.setStyle("fontFamily","myMyriadFont");               
                    lab.text = boxLabel+ String(num);
                    box.addChild(lab);
                    return box;                   
                  }
                   
                  private function cc():void{               
                     for each(var obj:Object in boxes){
                      var widthHeight:Number = obj.direction=="horizontal"?this[obj.hbox].width:this[obj.hbox].height;
                      for(var j:uint=1;j<=obj.num;j++){
                        this[obj.hbox].addChild(getBox(widthHeight, obj.label,j, obj.rotation, obj.direction));
                      }
                    }
                   }
                 
              ]]>
          </mx:Script>
          <mx:HBox id="hb1" width="100%" height="50" x="10" y="40" horizontalGap="1"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          <mx:HBox id="hb2" width="70%" height="50" x="10" y="66" horizontalGap="1"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          <mx:HBox id="hb3" width="70%" height="50" x="10" y="92" horizontalGap="1"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          <mx:VBox x="600" y="180" rotation="40" verticalGap="-24">
              <mx:HBox id="hb4" width="510" height="50" horizontalGap="1"
                horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
              <mx:HBox id="hb5" width="510" height="50" horizontalGap="1"
                horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          </mx:VBox>
          <mx:HBox x="200" y="610" paddingBottom="0" paddingTop="0">
              <mx:Label text="No.of Cargos :" fontSize="15" fontWeight="bold"/>
              <mx:ComboBox id="comboCrago" dataProvider="{['1','2','3','4','5','6','7','8','9','10']}"/>
          </mx:HBox>
      </mx:Application>

       

      It gives 5 HBoxes each contains number of boxes and each box contains label named like A1,A2,B1,B5 etc

      I need cinema seat booking like scenario i.e.

      if i selected 8 from combo box then i click on any box label

      if that clicked box label has continues 8 availability to select box labels it's fine

      if I have a chance to place 5 only in A then I want to select remaining three from any other boxes

      Please help......... me