怎么会画这条线在(0,0)并没有真正在(0,0)绘制它? [英] How come drawing this line at (0,0) doesn't really draw it at (0,0)?

查看:142
本文介绍了怎么会画这条线在(0,0)并没有真正在(0,0)绘制它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:一劳永逸,我怎么能画一条线,它从(0,0)到舞台对面的角落

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

下面是我:

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

    }

}

请参阅这里为与该文件发生的事情的一个例子。它嵌入在HTML页面。

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

推荐答案

在code ++工程。这只是该SWF是不一样大小的浏览器窗口。如果直接运行SWF或如果嵌入的SWF到深色的背景,你就能看到它的工作原理。

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.

这篇关于怎么会画这条线在(0,0)并没有真正在(0,0)绘制它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆