0 Replies Latest reply on Jan 26, 2010 11:09 PM by venkateshk

    Flex and Java

    venkateshk

      Please help....... me

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="white" creationComplete="cc()">
          <mx:RemoteObject id="service" destination="planSession"/>

          <mx:Script>
              <![CDATA[
                  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: 20, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb2", label: "B", num: 20, font: null, rotation: 0, direction: "vertical"},
                    {hbox: "hb3", label: "C", num: 20, font: null, rotation: 0, direction: "horizontal"},
                    {hbox: "hb4", label: "D", num: 20, font: null, rotation: 40, direction: "vertical"},
                    {hbox: "hb5", label: "E", num: 20, font: null, rotation: 40, 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));
                      }
                    }
                   
                    service.dlist();
                  }
               
              ]]>
          </mx:Script>

           <mx:HBox id="hb1" width="70%" height="50" x="10" y="40" horizontalGap="0"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          <mx:HBox id="hb2" width="70%" height="50" x="10" y="95" horizontalGap="0"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>
          <mx:VBox id="hb3" width="50" height="40%" x="10" y="200" verticalGap="0"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"/>

      </mx:Application>

      The application gives no.of boxes with label

      here  service.dlist()(dlist() is a method in my session bean planSession); returns a List from database with many rows with 5 columns one of the column is 'name' that has the values like A1,A2,B15,B18,C2etc

      I want to catch that list in my flex application and my interest is on name column only

      if name is A1 I want to highlight the A1 box with color

      this i want for all the values corresponding to name column