本文介绍了从jQuery的工具flashembed回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery的工具包括接受许多参数的flashembed API。是否有其中一个Flash播放器加载事件的成功状态后,接受回调函数和火灾?

jQuery Tools includes a flashembed API which accepts many parameters. Is there one which accepts callback function and fires after the success state of the flash player load event?


playerdiv.flashembed(网址+'/ VIPlayer.swf','knds_player',300,250,8.0.0,假的,flashVars中);

信息:

请注意:这是可能的如下

Note: This is possible in Google swfobject library as below:


swfobject.embedSWF(网址+'/ VIPlayer.swf','knds_player',300,250,8.0.0,假的,flashVars中,回调);

swfobject.embedSWF(url+'/VIPlayer.swf','knds_player',300,250,'8.0.0',false,flashVars,callBack);

回调函数(事件){
   code结果成功后显示事件
}

不过,我只需要使用flashembed。你能帮帮我吗?

But I need to use only flashembed. Can you please help me here?

在此先感谢:)

推荐答案

该flashembed方法有一个 onFail 参数,它需要一个回调作为值:

The flashembed method has an onFail argument which takes a callback as a value:

$("#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

It inadvertently fires on both success AND failure. Search for the , character to distinguish between the two states. On error, it shows up as the delimiter in the version string, such as 11,0 rather than 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);
  }

参考


这篇关于从jQuery的工具flashembed回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 22:26