为什么不会在Google Chrome中以动态显示的方式加载图像?

时间:2012-11-21 21:25:40

标签: actionscript-3 flash google-chrome plugins loader

我正在开发一款Flash游戏,根据HTML参数,某些内容可能因网页而异。不幸的是,当我尝试在Google Chrome中加载图片并将位图本身发送到舞台时,没有任何显示。我已经能够确定这不受欢迎是由于Chrome附带的Pepper Flash插件,因为它与手动安装的Flash插件一起使用。

用户下载一个他们认为已经拥有的插件只是为了使用我的游戏,这将是一件痛苦的事。我的游戏必须自己访问位图,因为它们会改变颜色。如何解决Chrome的Pepper Flash插件中的不良行为?

以下是我正在做的事情的样本。

        private function init(e:Event = null):void 
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point

        //could be any image, as long as image1.jpg is in the images directory relative to the HTML page
        //eventually will be taken from a parameter.
        var url:String = "images/image1.jpg";
        var request:URLRequest = new URLRequest(url);
        loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
        loader.load(request);

    }

    private function loaded(e:Event):void
    {
        image = Bitmap(loader.content);
        image.bitmapData.colorTransform(new Rectangle(0, 0, image.bitmapData.width, image.bitmapData.height), new ColorTransform(2, 1, 0.5, 0.25, 10, 10, -10, -10));
        graphics.beginBitmapFill(image.bitmapData);
        graphics.drawCircle(stage.stageWidth/2, stage.stageHeight/2, (image.width + image.height) / 4);
        graphics.endFill();

    }

除了此示例之外,还会有转换,但除非有解决此故障/不受欢迎的功能/错误的方法,否则在没有为用户工作的情况下,游戏无法在普通的Google Chrome浏览器上正常播放。

1 个答案:

答案 0 :(得分:1)

将其推送到服务器上。当你从localhost运行时,chrome有一些额外的安全性。

相关问题