2012-06-19 21 views
0

任何人都可以得到一個使用Flash Player 11.2的addEventListener嗎? 我總是得到這個錯誤:如果將我的flash播放器輸出到 這裏Flash Player 11.2視頻活動addEventListener

Scene 1, Layer 'actions', Frame 1, Line 104 1119: Access of possibly undefined property COMPLETE through a reference with static type Class.

是我的代碼:

import flash.events.Event; 
import fl.video.VideoEvent; 
import fl.video.*; 

myVideo.source ="videoName.flv"; 
myVideo.play(); 
myVideo.addEventListener(VideoEvent.COMPLETE, vidComplete) 

function vidComplete(event:VideoEvent) { 
     trace("done"); 
} 

回答

0

出於某種原因,在Flash CS6的AS3編譯器的Flash Player 11似乎忽略了fl.video。*的導入語句;

來源:http://forums.adobe.com/message/4699000

這個人的解決方案意味着,在代碼中指定整個類包直列如下應該可以緩解這個問題:

myVideo.source ="videoName.flv"; 
myVideo.play(); 
myVideo.addEventListener(fl.video.VideoEvent.COMPLETE, vidComplete) 

function vidComplete(event:fl.video.VideoEvent) { 
    trace("done"); 
}