Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Aug 2013
    Messaggi
    4

    Video e Layer con AS3 ed AIR for Android

    Sto sviluppando un player video per android utilizzando flash ed AIR.
    Il player ha un menu, che in genere compare sopra il video. E fin qui nessun problema.
    I problemi invece nascono quando metto in background la app e poi la riapro: il video riprendere l'esecuzione senza problemi (ho gestito la pausa ed il resume) ma passa in primo piano ed il menu non è più visibile.
    Ho controllato la lista di visualizzazione dello stage su cui sia il video che il menu sono caricati e l'ordine di inserimento è quello giusto!

    Da cosa potrebbe dipendere e come potrei porvi rimedio?


    S.

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2013
    Messaggi
    4
    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);
        
        }

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.