来自jQuery工具的回调
-
26-10-2019 - |
题
jQuery工具包括一个接受许多参数的闪存API。在Flash Player Load事件的成功状态后,是否有一个接受回调功能并发射?
playerdiv.flashembed(url+'/VIPlayer.swf','knds_player',300,250,'8.0.0',false,flashVars);
信息: 官方网站.
注意:这是可能的 Google swfobject库 如下:
swfobject.embedSWF(url+'/VIPlayer.swf','knds_player',300,250,'8.0.0',false,flashVars,callBack);
function callBack(event){
event after successful display of code
}
但是我只需要使用闪光。你能帮我吗?
提前致谢 :)
解决方案
闪存的方法有一个 onFail
参数以回调为值:
$("#flash").flashembed({
src: flashSWF,
version:[10,0],
id:"flashObj",
width: 500,
height: 300,
wmode: "opaque",
cachebusting: "false",
allowscriptaccess: "always",
api: "false",
scale: "noscale",
menu: "false",
onFail: flasherror("#flash")
})
它无意中开火并失败。搜索 ,
区分这两个状态的性格。错误,它显示为版本字符串中的定界符,例如 11,0
而不是 11.0
:
function flashError(domnode, newtext){
function failState()
{
if ($(domnode).html().search(/,/) !== -1) //player failed to load
{
newtext = $(domnode).html(); // store default error string
$(domnode).empty();
$(domnode).append(newtext.replace(/,/g,".")); // replace comma with period
if ($(domnode).hasClass("flashmsg") === false)
{
$(domnode).addClass("flashmsg"); // add class to custom error element
}
}
else
{
//success logic
}
}
// observer constructor
var cursor =
typeof window.hasOwnProperty === "function" ?
window.hasOwnProperty("WebKitMutationObserver")
? new WebKitMutationObserver(startValidation)
: window.hasOwnProperty("MutationObserver")
? new MutationObserver(startValidation)
: false
: false
;
//Use observer event if it exists
if (cursor)
{
//Bind observer event to text child of the dom node
cursor.observe($(domnode).get(0), { childList: true } );
return;
}
//Use mutation event as a fallback
else if (!!document.addEventListener)
{
$(domnode).get(0).addEventListener("DOMNodeInserted", failState, false);
}
//Use readystatechange event for legacy IE
else
{
$(domnode).get(0).addBehavior("foo.htc");
$(domnode).get(0).attachEvent("onreadystatechange", failState);
}
参考
不隶属于 StackOverflow