Hi,
There are lot of posts with regards to Security problems when trying to use draw(“file”); method on external file, however I’ve got this problem trying to use draw(stage) in FullScreen Mode.
Is this a case that using draw() on stage in FullScreen mode is impossible?
Is there any workaround to do that?
package {
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.MovieClip;
import com.zeeto.layout.fullscreen.FullScreenColorSmart;
public class Main extends MovieClip {
private var fullScreen:FullScreenColorSmart;
public function Main():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
if (stage) start();
else addEventListener(Event.ADDED_TO_STAGE, start);
}
private function start(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, start);
fullScreen= new FullScreenColorSmart();
addChild(fullScreen);
stage.addEventListener(Event.RESIZE, stageResize);
}
private function stageResize(e:Event):void {
fullScreen.reposition();
}
}
}
package com.zeeto.layout.fullscreen {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.geom.Matrix;
import flash.display.BitmapData;
import flash.geom.ColorTransform;
public class FullScreenColorSmart extends Sprite {
[Embed(source="/gfx/fullscreen.png")]
private var fs:Class;
private var fsIcon:Bitmap = new fs();
public function FullScreenColorSmart() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
addChild(fsIcon);
}
public function reposition():void {
var bmd:BitmapData = new BitmapData(1, 1);
var matrix:Matrix = new Matrix();
matrix.translate( -this.x - this.width, -this.y);
bmd.draw(stage, matrix); // Causes security error
var pixel:uint = bmd.getPixel(0, 0);
}
}
}