I am working on a flash game where some of the content can vary from web page to web page depending on the HTML options. Unfortunately, when I try to upload images to Google Chrome and send bitmaps to the scene, nothing appears. I was able to determine that this is undesirable due to the Pepper Flash plugin that comes with Chrome, since it works with the manually installed Flash plugin.
It will be a pain for the user to have users download the plugin that they think they already have to use my game. For my game, I need to access the bitmap images themselves, because they will change color. How can I get around unwanted behavior in the Chrome Pepper Flash plugin?
Below is an example of what I am doing.
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(); }
There will be conversions other than this sample, but if there is no way to avoid this error / unwanted function / error, the game cannot be played properly in the average Google Chrome browser without work for the user.
source share