How do you draw a line from one corner of the stage to the other?
Posted
by George Edison
on Stack Overflow
See other posts from Stack Overflow
or by George Edison
Published on 2010-04-14T02:22:59Z
Indexed on
2010/04/14
2:33 UTC
Read the original article
Hit count: 358
I am completely perplexed. I asked this question and it (any mentioned solution) doesn't seem to be working at all.
All I want is to draw a line from one corner to the other.
Here again is the link to the SWF file I have (it's embedded in an HTML document): test.html
Here is the source:
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
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
graphics.clear();
graphics.lineStyle(10, 0x000000);
graphics.moveTo(0, 0);
graphics.lineTo(stage.stageWidth, stage.stageHeight);
}
}
}
It just doesn't work! The line goes from somewhere offscreen to about the middle of the stage. What on earth am I doing wrong?
© Stack Overflow or respective owner