我想通过javascript与flash通信,控制我的flash播放器这是我的代码,但我有一个错误,请你帮帮我,
var flashvars = {
flvpVideoSource: "myApp.swf",
flvpWidth: "640",
flvpHeight: "360"
};
var params = {
menu: "true",
allowfullscreen: "true"
};
var attributes = {
id: "FLVplayer",
name: "FLVplayer"
};
//functions used to find the id of the flash object
function getFlashMovieObject(movieName){
if(document.embeds[movieName])
return document.embeds[movieName];
if(window.document[movieName])
return window.document[movieName];
if(window[movieName])
return window[movieName];
if(document[movieName])
return document[movieName];
return null;
}
//function in flash to play the video
function playMyVideoInFlash(){
var flashMovie = getFlashMovieObject("FLVplayer");
flashMovie.playMyVideo();
}
//function in flash to pause the video
function pauseMyVideoInFlash(){
var flashMovie = getFlashMovieObject("FLVplayer");
flashMovie.pauseMyVideo();
}
</script>
这是我的错误:
Uncaught TypeError: Cannot call method 'playMyVideo' of null index.html:37
playMyVideoInFlash index.html:37
onclick
我的按钮代码:
<button type="button" onclick="playMyVideoInFlash()">play</button>
<button type="button" onclick="pauseMyVideoInFlash()">pause</button>
提前致谢