# Flex doesn't work the way it should

**URL:** <https://forum.kirupa.com/t/flex-doesnt-work-the-way-it-should/303881>\
**Category:** Uncategorized\
**Created:** [January 28, 2010, 5:27pm UTC](https://forum.kirupa.com/t/flex-doesnt-work-the-way-it-should/303881 "2010-01-28T17:27:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashCS4User](https://avatars.discourse-cdn.com/v4/letter/f/5f9b8f/32.png) [@flashCS4User](https://forum.kirupa.com/u/flashCS4User)\
**Post date:** [January 28, 2010, 5:27pm UTC](https://forum.kirupa.com/t/flex-doesnt-work-the-way-it-should/303881/1 "2010-01-28T17:27:44Z")

</div>

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.

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; // WTFreak is going on? 
                           //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\>
