开发者

Loading jQuery from Google into an Air project

I'm using Aptana Studio with the following source code:

<html>
<head>
<title>New Adobe AIR Project</title>
<script type="text/javascript" src="lib/air/AIRAliases.js"></script>
<script type="text/javascript" src="lib/air/AIRI开发者_开发问答ntrospector.js"></script>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1");
</script>
<script>
$(function() {
    alert('ok');
})
</script>
</head>
<body>
</body>
</html>

This works if I just pull up the page as an html page. But why am I getting

ReferenceError: Can't find variable: google.

ReferenceError: Can't find variable: $

When I use Aptana's Run command, or even if I build the application into an .air file and run it from Window's explorer.


You cannot load external JS files using the tag in an AIR application. It violates the AIR security stuff.

You MUST load js files from the application sandbox.

http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f0e.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7ef7

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜