js和使用SwfObject嵌入Flash文件的通信

首先,swfobject调用Flash文件比较简单。

1、引入swfobject.js文件。

<script src='swfobject2.2.js' type='text/javascript'></script>

2、编写调用脚本。

Public Sub LoadFlash()

Dim swfName As String = GlobalBusiness.GetFlashServerVirtuaPath & "/VideoServer.swf"

Dim strFlashcode As New StringBuilder

strFlashcode.Append("<script type='text/javascript'>" & vbCrLf)

strFlashcode.Append("   var params = {" & vbCrLf)

strFlashcode.Append("        bgcolor: '#ffffff'," & vbCrLf)

strFlashcode.Append(" allowfullscreen: 'true'," & vbCrLf)

strFlashcode.Append("        allowScriptAccess: 'always'," & vbCrLf)

strFlashcode.Append("        pluginspage: 'http://www.adobe.com/go/getflashplayer'," & vbCrLf)

strFlashcode.Append("        quality: 'high'" & vbCrLf)

strFlashcode.Append("    };" & vbCrLf)

 

            strFlashcode.Append(

"    var attributes = {" & vbCrLf)

 

            strFlashcode.Append(

"        id: 'myView'," & vbCrLf)

 

            strFlashcode.Append(

"        name: 'myView'" & vbCrLf)

 

            strFlashcode.Append(

"    };" & vbCrLf)

 

            strFlashcode.Append(

"    var flashvars = {" & vbCrLf)

 

            strFlashcode.Append(

"      videoWidth: 0," & vbCrLf)

 

            strFlashcode.Append(

"      videoHeight: 0," & vbCrLf)

 

            strFlashcode.Append(

"      role:'" & Rose & "'," & vbCrLf)

 

            strFlashcode.Append(

"      Id:'" & ChapterID & "'," & vbCrLf)

 

            strFlashcode.Append(

"      picxml:'" & arrFileName(0) & "'," & vbCrLf)

 

            strFlashcode.Append(

"      picpath:'" & String.Concat(GlobalBusiness.GetFlashServerVirtuaPath, "/Profile/VideoClass/", ChapterID, "/") & "'" & vbCrLf)

 

            strFlashcode.Append(

"    };" & vbCrLf)

 

            strFlashcode.Append(

"    swfobject.embedSWF('" & swfNameRight & "', 'myContent', '420', '300', '8.0.0', '', flashvars, params, attributes);" & vbCrLf)

 

      

            strFlashcode.Append(

"   var leftparams = {" & vbCrLf)

 

            strFlashcode.Append(

"        bgcolor: '#000000'," & vbCrLf)

 

            strFlashcode.Append(

"        allowfullscreen: 'true'," & vbCrLf)

 

            strFlashcode.Append(

"        allowScriptAccess: 'always'," & vbCrLf)

 

            strFlashcode.Append(

"        pluginspage: 'http://www.adobe.com/go/getflashplayer'," & vbCrLf)

 

            strFlashcode.Append(

"        quality: 'high'" & vbCrLf)

 

            strFlashcode.Append(

"    };" & vbCrLf)

 

            strFlashcode.Append(

"    var leftattributes = {" & vbCrLf)

 

            strFlashcode.Append(

"        id: 'myVideo'," & vbCrLf)

 

            strFlashcode.Append(

"        name: 'myVideo'" & vbCrLf)

 

            strFlashcode.Append(

"    };" & vbCrLf)

 

            strFlashcode.Append(

"    var leftflashvars = {" & vbCrLf)

 

            strFlashcode.Append(

"      videoWidth: 0," & vbCrLf)

 

            strFlashcode.Append(

"      videoHeight: 0," & vbCrLf)

 

            strFlashcode.Append(

"      role:'" & Rose & "'," & vbCrLf)

 

            strFlashcode.Append(

"      Id:'" & ChapterID & "'};" & vbCrLf)

 

            strFlashcode.Append(

"    swfobject.embedSWF('" & swfName & "', 'myVideoClass', '256', '192', '9.0.0', '', leftflashvars, leftparams, leftattributes);" & vbCrLf)

 

            strFlashcode.Append(

"</script>" & vbCrLf)

 

            flashControlScript.Text = strFlashcode.ToString

 

       

End Sub

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值