4 Replies Latest reply on Jul 2, 2010 11:00 PM by davyy

    how to draw on the swfloader?

    davyy

      I want to draw a line on the swfloader,but the line is invisile ,how to solve it ,thx!

      another question:

      if line can be drawn,how to magnify the painter and swfloader with  the same scale ?

      codes below:

      <mx:Canvas id="painter" width="100%" height="100%">
      <mx:SWFLoader source="c:\1.swf" scaleContent="true" width="100%" height="100%">
      </mx:SWFLoader>
      </mx:Canvas>
      <mx:Button label="draw" id="btn" click="btn_clickHandler(event)">


      protected function btn_clickHandler(event:MouseEvent):void
      {
      // TODO Auto-generated method stub
      painter.graphics.lineStyle(5,255);
      painter.graphics.moveTo(0,0);
      painter.graphics.lineTo(255,255);

      }

        • 1. Re: how to draw on the swfloader?
          Flex harUI Adobe Employee

          Children lie on top of their parents.

           

          Try:

          <mx:Canvas id="container" width="100%" height="100%">

          <mx:SWFLoader source="c:\1.swf" scaleContent="true" width="100%"

          height="100%">

          </mx:SWFLoader>

          <mx:Canvas id="painter" width="100%" height="100%" />

          </mx:Canvas

           

          • 2. Re: how to draw on the swfloader?
            davyy Level 1

            i try with your metion,but the problem still exists!

            • 3. Re: how to draw on the swfloader?
              Flex harUI Adobe Employee

              What does your code look like now?  Try drawing a rect or something easy to

              see.

              • 4. Re: how to draw on the swfloader?
                davyy Level 1

                thx,with your help i have drawn the line!

                how to zoom in or out the graphics and swfloader with the same scale?

                 

                <?xml version="1.0" encoding="utf-8"?>

                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                      xmlns:s="library://ns.adobe.com/flex/spark"

                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"

                minHeight="600" >

                <s:layout>

                  <s:BasicLayout/>

                </s:layout>

                <fx:Script>

                  <![CDATA[

                   import mx.controls.Alert;

                   import mx.controls.Label;

                   import mx.core.UIComponent;

                   import mx.events.FlexEvent;

                 

                 

                 

                   public function del(event:MouseEvent):void

                   {

                 

                   }

                   protected function btn_clickHandler(event:MouseEvent):void

                   {

                    painter.graphics.lineStyle(5,255);

                    painter.graphics.moveTo(0,0);

                    painter.graphics.lineTo(255,255);

                 

                 

                   }

                 

                 

                  ]]>

                </fx:Script>

                <fx:Declarations>

                 

                </fx:Declarations>

                 

                <mx:Canvas id="container" width="100%" height="100%">

                  <mx:SWFLoader source="c:\1.swf" scaleContent="true" width="100%"

                       height="100%">

                    </mx:SWFLoader>

                  <mx:Canvas id="painter" width="100%" height="100%" />

                </mx:Canvas>

                 

                    <mx:Button id="btn" label="draw" click="btn_clickHandler(event)">

                  </mx:Button>

                </s:Application>

                 

                 

                 

                2010/7/3 Flex harUI <forums@adobe.com>

                 

                What does your code look like now?  Try drawing a rect or something easy to

                see.

                >