2014-12-29 63 views
0

我已經搜索了高和低的答案。我使用AS2而不是AS3,我知道有幾種方法可以全屏顯示視頻/音頻/文本聊天SWF,但是有什麼方法可以在Flash文件中創建一個僅用於全屏顯示視頻窗口mc的按鈕?如果我正常顯示全屏,它會顯示文本和所有我想顯示的全屏單擊時顯示的視頻窗口。我不知道如何做到這一點。任何幫助都會很棒。如果答案是在這個網站或網上,我不知道我是如何錯過它的,因爲我一直在尋找大約3周沒有運氣。如果是,請接受我的道歉。在此先感謝所有的火箭科學家:)AS2全屏僅在舞臺上的視頻窗口

回答

0

要做你想做的事情,你可以做正常的全屏和設置你的視頻尺寸爲Stage.widthStage.height,當然不要忘記設置深度也。

就拿這個例子中,你可以在網上here看到:

// don't forget to set the Stage.scaleMode and Stage.align 
Stage.scaleMode = 'showAll'; // noBorder, exactFit, noScale 
Stage.align = 'T'; // top center 

// boolean to indicate if we do the fullscreen of the video element 
var video_is_fullscreen:Boolean = false; 
var server:String = null; 
var stream = 'http://stream.flowplayer.org/flowplayer-700.mp4'; 

var nc:NetConnection = new NetConnection(); 
    nc.connect(server); 
var ns:NetStream = new NetStream(nc); 
    ns.play(stream); 

    // we use a Video element inside a MovieClip to set the object depth later 
    video_player.video.attachVideo(ns); 
    video_player.video.smoothing = true; 

    // just to disable sound 
    video_player.attachAudio(ns); 
    var audio:Sound = new Sound(video_player); 
     audio.setVolume(0); 

// toggle play/pause video 
video_player.onPress = function(){ 
    ns.pause(); 
} 

// set stage fullscreen mode 
btn_fullscreen.onPress = function(){ 
    full_screen(); 
} 

// set video element fullscreen mode 
btn_fullscreen_video.onPress = function(){ 
    video_is_fullscreen = true; 
    full_screen(); 
} 
function full_screen(){ 
    Stage.displayState = Stage.displayState == 'normal' ? 'fullScreen' : 'normal'; 
} 

// add stage fullscreen event listener 
var event_listener:Object = new Object(); 
Stage.addListener(event_listener); 
event_listener.onFullScreen = function(fullscreen_active:Boolean){ 
    if(video_is_fullscreen){  
     if(fullscreen_active){ 
      // set our video element fullscreen mode 
      video_player._x = video_player._y = 0; 
      video_player._width = Stage.width; 
      video_player._height = Stage.height; 
     } else { 
      // set our video element to it's normal mode 
      video_player._x = 10; 
      video_player._y = 30; 
      video_player._width = 160; 
      video_player._height = 120; 
      video_is_fullscreen = false; 
     }  
    } else { 
     video_is_fullscreen = false; 
    } 
} 

// set depths of all stage elements 
function set_depths():Void { 
    image.swapDepths(2); 
    txt.swapDepths(4); 
    video_player.swapDepths(8); 
    btn_fullscreen.swapDepths(6); 
    btn_fullscreen_video.swapDepths(10); 
} 

set_depths(); 

當然這一點僅僅是一個例子向您展示的方式做一個全屏的視頻,您就能夠改善它,它適應您的需求。

希望所有可以幫助你。

+0

謝謝,我會稍微嘗試一下,我看到代碼中的平滑。我運行實時視頻流,並在過去遇到過問題,並嘗試使用平滑功能,但從未注意到任何區別,是否只能在全屏擴展模式下工作? – dellee

+0

@dellee是的,就是這樣。 – akmozo