在Flash加载JavaScript(图片参考) [英] Loading Javascript in Flash (picture reference)

查看:158
本文介绍了在Flash加载JavaScript(图片参考)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助!我想加载图片的网址在Flash AS3我有以下code在JavaScript中,显示的图像。不过,我要加载Flash中的相同的参考。

  FB.api('/我?域=用户名',函数(响应){
功能检测(URL){
       VAR形象=新的图像();
       image.src =网址;
       image.onload =功能(){
       VAR的结果='结果'; //一个例子结果
    }
document.body.appendChild(图)
}
检测(https://graph.facebook.com/+ response.username +/图片宽度= 200安培;高度= 200);
 

解决方案

您不能调用从AS3直接,因为Facebook的库是用JavaScript编写的API。你将不得不使用JS作为中介。然而,吉奥的回应以上是正确的。使用ExternalInterface API从JS传递消息给AS。我贴你需要在JS低于它建立在他写的修改。

他的答案是正确的,完整的,你应该将其标记为此类。

  FB.api('/我?域=用户名',函数(响应){
功能检测(URL){
       VAR形象=新的图像();
       image.src =网址;
       image.onload =功能(){
       VAR的结果='结果'; //一个例子结果
    }

//从吉奥的code粘贴以上
VAR瑞士法郎=的document.getElementById(myFlash); //得到一个参考
swf.loadImage(myURL); //调用你的AS3功能
}
检测(https://graph.facebook.com/+ response.username +/图片宽度= 200安培;高度= 200);
 

I need help! i want to load a picture url in Flash AS3 i have the following code in javascript that shows the picture. however i want to load the same reference in Flash..

FB.api('/me?fields=username', function(response) { 
function detect(URL) {
       var image = new Image();
       image.src = URL;
       image.onload = function() {
       var result = 'result'; // An example result
    }
document.body.appendChild(image)
}
detect("https://graph.facebook.com/" + response.username + "/picture?width=200&height=200");

解决方案

You cannot call the API from AS3 directly because Facebook's library is written in JavaScript. You'll have to use JS as the intermediary. However, Gio's response above is correct. Use the ExternalInterface API to pass a message from JS to AS. I'm pasting the modifications you need to make in JS below which builds upon what he has written.

His answer is correct and complete and you should mark it as such.

FB.api('/me?fields=username', function(response) { 
function detect(URL) {
       var image = new Image();
       image.src = URL;
       image.onload = function() {
       var result = 'result'; // An example result
    }

// Pasted from Gio's code above
var swf = document.getElementById("myFlash"); // get a reference
swf.loadImage(myURL); // call your AS3 function
}
detect("https://graph.facebook.com/" + response.username + "/picture?width=200&height=200");

这篇关于在Flash加载JavaScript(图片参考)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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