简体   繁体   English

启动时如何在屏幕上居中放置闪光灯?

[英]How to center a flash projector on screen when launched?

Is there a way to center a flash projector on a screen when it is launched? 启动时,是否可以将闪光灯投影仪放在屏幕中央? I noticed when I launch a flash projector file, it gets positioned on the screen randomly. 我发现启动Flash投影仪文件时,它会随机放置在屏幕上。 I am using ActionScript 3. 我正在使用ActionScript 3。

AFAIK it is not possible, but I can think of two workarounds: AFAIK不可能,但是我可以想到两种解决方法:

  • Call fscommand("exec", args) and call some custom application that centers the projector window, through FindWindowEx and SetWindowPos. 调用fscommand(“ exec”,args)并通过FindWindowEx和SetWindowPos调用一些将投影仪窗口居中的自定义应用程序。
  • Make your own app that plays the SWF file (by wrapping it in a browser, or using some alternative like the OCX) and is already centered. 制作自己的应用程序来播放SWF文件(通过将其包装在浏览器中,或使用诸如OCX之类的替代方法)并且已经居中。

Since both of them require you to make another app, I'd go myself with the first option in this case. 由于两者都要求您制作另一个应用程序,因此在这种情况下,我会选择第一个选项。 If it would require more things I'd go with the second one. 如果需要更多的东西,我会选择第二个。

EDIT: Although depending on your experience, and language knowledge the second one may be best. 编辑:虽然取决于您的经验和语言知识,第二个可能是最好的。

If you need to center your project sprite in the flash player after start (otherwise I get it wrong), you need to 1) set size of the project sprite manually and 2) set stage scale mode: 如果您需要在启动后在Flash Player中将项目精灵居中(否则我会弄错),则需要1)手动设置项目精灵的大小,以及2)设置舞台缩放模式:

package
{
    import flash.display.Sprite;
    import flash.display.StageScaleMode;

    [SWF(width="203", height="203")]
    public class MyProject extends Sprite
    {
        public function MyProject()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;

            var sprite:Sprite = new Sprite;
            sprite.graphics.lineStyle(1, 0, 1);
            sprite.graphics.drawRect(0, 0, 200, 200);
            addChild(sprite);
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM