AS3 ExternalInterface的电话使用jQuery [英] AS3 ExternalInterface call using jquery

查看:197
本文介绍了AS3 ExternalInterface的电话使用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打电话到嵌入在使用ExternalInterface一个HTML页面中的Flash应用程序。 下面code正常工作(我用一个按钮来测试):

  $(文件)。就绪(函数(){
    $(#键)。点击(函数(){
        VAR应用=的document.getElementById('的applicationID)
        console.debug(表观)
        app.pageUnloading()
    })
})
 

所以这个调用到Flash应用程序精细和打印:

 <嵌入ID =的applicationIDWIDTH =600HEIGHT =400ALIGN =中间类型=应用程序/ x-冲击波闪光PLUGINSPAGE =HTTP ://www.adobe.com/go/getflashplayer的allowScriptAccess =导航特殊NAME =FlexMoedersBGCOLOR =#CCCCCC品质=高SRC =ApplicationID.swf>
 

但是,当我使用由ID获取元素的jQuery的$#方法,我收到了不同的对象返回:

  $(文件)。就绪(函数(){
    $(#键)。点击(函数(){
        VAR应用= $(#的applicationID)
        console.debug(表观)
        app.pageUnloading()
    })
})
 

当我用这个告诉我:

  app.pageUnloaded不是一个函数
 

和以下被打印

  [嵌入#的applicationID]
 

我也曾尝试:

  VAR应用= $(#的applicationID)。VAL()

VAR应用= $(#的applicationID)。得到(0)
 

但仍然没有成功。没有人有任何想法在这里?

解决方案

  VAR应用= $('#的applicationID')[0]
 

  VAR应用= $('#的applicationID)。得到(0)
 

应该做同样的事情,

  VAR应用=的document.getElementById('的applicationID)
 

I'm calling into a flash app embedded in a html page using the ExternalInterface. The following code works fine (I'm using a button to test):

$(document).ready(function(){
    $("#button").click(function(){
        var app = document.getElementById('ApplicationID')
        console.debug(app)
        app.pageUnloading()
    })
})

So this calls into the flash app fine and prints:

<embed id="ApplicationID" width="600" height="400" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" allowscriptaccess="sameDomain" name="FlexMoeders" bgcolor="#cccccc" quality="high" src="ApplicationID.swf">

But when I use the jquery $# method of getting an element by id, I receive a different object back:

$(document).ready(function(){
    $("#button").click(function(){
        var app = $("#ApplicationID")
        console.debug(app)
        app.pageUnloading()
    })
})

When I use this I'm told:

app.pageUnloaded is not a function

and the following is printed:

[embed#ApplicationID]

I have also tried:

var app = $("#ApplicationID").val()

var app = $("#ApplicationID").get(0)

But still no success. Does anyone have any ideas here?

解决方案

var app = $('#ApplicationID')[0]

or

var app = $('#ApplicationID').get(0)

should do the same thing as

var app = document.getElementById('ApplicationID')

这篇关于AS3 ExternalInterface的电话使用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆