2012-03-15 70 views
0

我想使用Flash Pro CS5.5爲iOS構建應用程序,我需要在我的一個頁面上實現一個簡單的視頻,並且無法控制它。谷歌上搜索了幾個小時後,我終於得到了一個視頻工作,沒有掛鉤運行到頁面上,但我仍然無法左右的幾件事情讓我的頭:適用於iOS,Air Flash AS3的stageWebView視頻 - 如何控制它?

  • 我怎樣才能防止其自動播放?我沒有看到任何選項或變化,我可以改變,以防止應用程序加載後立即播放
  • 是否可以將stageWebView嵌入到MovieClip中?現在它只是在所有東西之間加載,是否可以移動/縮放/淡入/等等。 我想這應該與我設置舞臺或viewPort的位置有關,但我無法弄清楚。

以下是我的代碼:

import flash.geom.Rectangle; 
import flash.media.StageWebView; 
import flash.filesystem.File; 


var webView:StageWebView = new StageWebView(); 
var path:String = new File(new File("app:/video.mp4").nativePath).url; 

videoBtn.addEventListener(MouseEvent.CLICK,videoOpen); 
videoBtn.buttonMode = true; 
videoBtn.alpha = 0; 

function videoOpen(event:Event = null):void{ 
    webView.stage = this.stage; 
    webView.viewPort = new Rectangle(100, 100, 600, 480); 
    webView.loadURL(path); 
} 


videoBtnStop.addEventListener(MouseEvent.CLICK,videoClose); 
videoBtnStop.buttonMode = true; 
videoBtnStop.alpha = 0; 

function videoClose(event:Event = null):void{ 
    webView.viewPort = null; 
    webView.dispose(); 
    webView = null; 
} 
+0

你爲什麼使用StageWebView作爲視頻?檢查此:http://www.adobe.com/devnet/flashplayer/articles/stage_video.html 這一個運行smoohly,你可以控制它作爲一個正常的視頻。 – 2012-03-15 08:26:18

+0

我已經看了stageVideo,但我不能'找到任何Flash Professional CS5的例子,他們都使用Flash Builder或flex等 我也對使用類/外部.AS,如果有某種示例源文件,這只是一個簡單的.fla與內聯代碼,我很樂意使用stageVideo。 – user1172903 2012-03-15 22:15:05

回答

2

順便提及,web視圖對象不顯示列表存在,因此,在一個movieclip不能被「嵌入」。

如果你想控制的地方坐(因爲它會坐在一切的頂部)改變矩形:

webView.viewPort =新的Rectangle(100,100,600,480);

通過縮小矩形,可以將Web視圖的可見區域縮小到足以顯示其後的Flash內容。