How do you draw a line from one corner of the stage to the other?
- by George Edison
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?