4 Replies Latest reply on Mar 21, 2010 11:00 PM by Flex harUI

    positioning of x

    flexUser1234 Level 1

      I have 3 files. 2 actionscript files and a html file. I want the image to show up at the 0 X coordinate. It shows up at a non-zero position in the browser (firefox 3.*) after I compile everything with flex SDK and run the html file. BUG with flex? The embedded png image is 1019 pixels wide. What's going on? Attached is a picture of what I see in firefox.  I heard there were different types of x values... Content x, stage x, what else am I missing? how do I fix the x to work the way i want it to?


      package
      {
      // first file. 
      import flash.display.Sprite;
      import flash.display.Bitmap;
      [SWF(width="1019", height="15")]
      public class myblackRectangle extends Sprite
      {
      [Embed(source="images/mybar.png")]
      private var rectangleImage:Class;


      public function myblackRectangle()
      {
      var aSprite= new rectangleImage();
      addChild(aSprite);
      }
      }
      }

      package
      {
      // Adds the sprite defined in first file as a child to this sprite.
      import flash.display.Sprite;
      import myblackRectangle;


      public class mycanvas extends Sprite
      {
      public function mycanvas()
      {

      var aSprite = new myblackRectangle();
      aSprite.x = 0;   // what the...
      //the sprite shows up in                          
      //middle of the swf
      aSprite.y = 0;
      addChild(aSprite);
      }
      }
      }

      finally, the basic html embedding stuff.

      <html>

      <head>

      </head>

      <body>
      <object width="1019" height="300">
      <param name="movie" value="mycanvas.swf">
      <embed src="mycanvas.swf" width="1019" height="300">
      </embed>
      </object>
      </body>

      </html>