How come drawing this line at (0,0) doesn't really draw it at (0,0)?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-04-13T05:32:46Z Indexed on 2010/04/13 5:42 UTC
Read the original article Hit count: 262

Filed under:
|
|

I have this ActionScript code here:

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);
        }

    }

}

What I'm expecting this to do is to draw a line from one corner of the screen to the other... but that's not what it does. See here.

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript