来自 jquery Tools flashembed 的回调

发布于 2024-12-19 01:35:54 字数 668 浏览 5 评论 0原文

jQuery Tools 包含一个 flashembed API,它接受许多参数。是否有一个接受回调函数并在 Flash 播放器加载事件成功状态后触发的函数?

<代码> 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);

函数callBack(event){ 成功显示代码后的事件
}

但我只需要使用 flashembed。你能帮我一下吗?

提前致谢 :)

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(url+'/VIPlayer.swf','knds_player',300,250,'8.0.0',false,flashVars);

Information: official website.

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


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

function callBack(event){
event after successful display of code
}

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

Thanks in Advance :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦屿孤独相伴 2024-12-26 01:35:54

flashembed 方法有一个 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);
  }

参考

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")
   })

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);
  }

References

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文