0 Replies Latest reply on Oct 15, 2010 6:20 AM by mikall1979

    SWFloader.source troubles


      Hi all,
      I have some troubles  with this simple code.
      At the first click on the button "rotate" the  image rotates,
      after next click on the button... the image  disappears...


      Could someone help me?
      Any help will be  appreciated, thanks!


      <?xml version="1.0"  encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"  minHeight="600">
                   import flash.display.Bitmap;
                  import  flash.display.BitmapData;
                  private  function rotate(img:SWFLoader, angle:Number, x:int, y:int):void
                      var bd:Bitmap =  Bitmap(img.content);                                               

                       var m:Matrix = new Matrix();
                      //m.tx = -x;
                       //m.ty = -y;
                       //m.tx = x;
                      //m.ty = y;

                      var  bd2:BitmapData = new BitmapData(img.content.width,  img.content.height);                   
                      bd2.draw(bd,  m);               
                      var bitmap:Bitmap = new  Bitmap(bd2);
                      imageTest.source = bitmap;

          <mx:SWFLoader  id="imageTest" x="46" y="31" source="test.jpg" width="218"  height="312"/>
          <s:Button x="77" y="437" label="Rotate"  click="rotate(imageTest, 0.01, 50, 50)"/>