5 Replies Latest reply on May 15, 2012 1:14 AM by satyasuppu

    Draw lines inside container

    satyasuppu

      Hi ,

       

      I have req like need to dispaly line end of application.To show the data on the UI.I have created a custom mxml component(Canvas).Inside this canvas i have created the controls inside VBox container.

       

      I need to display 5 line before end of the application.So if user scrolls the application at the end he can see 5 lines before it end.

       

      Please need sample code to show these line.Please help me.

       

      I tried with below code.But its not working.Please help me.

       

       

      <mx:VBox width="100%" verticalGap="5">

       

      -----------------Other Controls--   ---------------------

             <mx:HBox id="drawStLine2" width="100%" height="100%" initialize="drawLineInit()" />

       

      </mx:VBox>

        

      public function drawLineInit():void {

           var myShape:Shape = new Shape(); 

             myShape = new Shape() ;

             myShape.graphics.lineStyle(5, 0x990000, .75);  

             myShape.graphics.moveTo(100, 100);   

             myShape.graphics.lineTo(500, 500);

             drawStLine1.addChild(myShape);

      }

       

       

      Thanks in advance

        • 1. Re: Draw lines inside container
          luisborlido Level 1

          Try drawStLine1.rawChildren.addChild(myShape);

          • 2. Re: Draw lines inside container
            satyasuppu Level 1

            Thanks for your quick reply.Its is not working.

            • 3. Re: Draw lines inside container
              luisborlido Level 1

              Try this:

              var myShape:Shape = new Shape();

              myShape.graphics.lineStyle(5, 0x990000, .75);

              myShape.graphics.moveTo(0, 0);  

              myShape.graphics.lineTo(100, 100);

              myShape.graphics.moveTo(50, 0);  

              myShape.graphics.lineTo(150, 100);

              myShape.graphics.moveTo(100, 0);  

              myShape.graphics.lineTo(200, 100);

              myShape.graphics.moveTo(150, 0);  

              myShape.graphics.lineTo(250, 100);

              myShape.graphics.moveTo(200, 0);  

              myShape.graphics.lineTo(300, 100);

              drawStLine2.rawChildren.addChild(myShape);

               

              The code above draws 5 diagonal lines with weight 5px, alpha 0.75 and dark red color.

              • 4. Re: Draw lines inside container
                satyasuppu Level 1

                Thanks for your answer.But i should display only straight lines.

                Please help me.

                • 5. Re: Draw lines inside container
                  satyasuppu Level 1

                  ------------------------------------------------------------------------------------------ -----------------------------------

                  ------------------------------------------------------------------------------------------ -----------------------------------

                  ------------------------------------------------------------------------------------------ -----------------------------------

                  ------------------------------------------------------------------------------------------ -----------------------------------

                  ------------------------------------------------------------------------------------------ -----------------------------------

                   

                  I have to display like this(not dottted lines) .Its a thick line.

                   

                  Thanks,

                  Saritha