aggiungo un codice di esempio che mi genera questo problema:
codice:
public function FullScreenAir()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, handleUI);
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void{
e.target.removeEventListener(e.type, arguments.callee);
createVideo(video su uno spazio web/ in formato.mp4);
createControls();
handleUI();
stage.displayState=StageDisplayState.NORMAL;
stage.addEventListener(Event.ACTIVATE, attivato);
}
private function attivato(e:Event){
if(video) setChildIndex(video,0)
if(switcher) addChild(switcher);
trace("attivato");
}
private function createVideo(url:String):void{
video = new Video();
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var clientOBJ:Object = new Object();
clientOBJ.onMetaData = metaDataHandler;
videoStream.client = clientOBJ;
videoStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
addChild(video);
video.attachNetStream(videoStream);
videoStream.play(url);
}
private function metaDataHandler(infoObject:Object):void {
}
private function onAsyncError(e:AsyncErrorEvent):void {
}
private function onMetadata(e:Event):void {
}
private function createControls():void{
switcher = new SimpleButton();
var rect:Shape = new Shape();
rect.graphics.beginFill(0xff0000, 1);
rect.graphics.drawRect(0, 0, 200, 100);
switcher.upState = rect;
switcher.downState = rect;
switcher.overState = rect;
switcher.hitTestState = rect;
addChild(switcher);
}
private function handleUI(e:StageOrientationEvent = null):void{
video.x = (stage.stageWidth - video.width) / 2;
video.y = (stage.stageHeight - video.height) / 2;
switcher.x = video.x+(switcher.width/2);
switcher.y = video.y+ (switcher.height/2);
}