views:

47

answers:

1

Update: Once and for all, how can I draw a line that goes from (0,0) to the opposite corner of the stage?

Here is what I have:

package 
{
    import flash.display.Sprite;

    import flash.display.LineScaleMode;
    import flash.display.CapsStyle;
    import flash.display.JointStyle;

    import flash.display.Shape;
    import flash.events.Event;

    public class Main extends Sprite 
    {

        private var lines:Shape;

        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point

            lines = new Shape();
            addChild(lines);

            lines.graphics.clear();
            lines.graphics.lineStyle(10, 0x000000);

            lines.graphics.moveTo(0, 0);

            lines.graphics.lineTo(stage.stageWidth, stage.stageHeight);
        }

    }

}

See here for an example of what happens with the file. It's embedded in an HTML page.

A: 

The code works. It's just that the SWF is not the same size as the browser window. If you run the swf directly or if you embed the swf onto a dark colored background you will be able to see that it works.

jonathanasdf
On Chrome, the left is offset a bit.
George Edison
It just doesn't work. See my update.
George Edison