Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
试图将远程图像加载到flash sideshow中_Flash_Security_Actionscript - Fatal编程技术网

试图将远程图像加载到flash sideshow中

试图将远程图像加载到flash sideshow中,flash,security,actionscript,Flash,Security,Actionscript,即使我使用绝对路径,尝试将远程图像加载到flash sideshow本地文件也可以工作。我正在更新现有的图库,以便从Picasa动态提取图像 php工作正常,并从API中提取图像。 但是当我将XML传递给flash时,它不会加载远程图像 我补充说 System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); 到ActionScript,但它仍然无法工作 旁白的纸条是: 1. Syst

即使我使用绝对路径,尝试将远程图像加载到flash sideshow本地文件也可以工作。我正在更新现有的图库,以便从Picasa动态提取图像

php工作正常,并从API中提取图像。

但是当我将XML传递给flash时,它不会加载远程图像

我补充说

System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); 
到ActionScript,但它仍然无法工作

旁白的纸条是:

1.
System.security.loadPolicyFile(“http://photos.googleapis.com/data/crossdomain.xml"); 
System.security.allowDomain(“*”);
MovieClip.prototype.addProperty(“onLoad”,函数(){
返回[this];
},功能(f){
if(uuu onLoadHandler_uuuu==未定义){
_全局.uu onLoadHandler_uu={};
}
__onLoadHandler_u[this]=f;
});
Math.easeInQuad=函数(t,b,c,d){
返回c*(t/=d)*t+b;
};
Math.easeOutQuad=函数(t,b,c,d){
返回-c*(t/=d)*(t-2)+b;
};
Stage.scaleMode=“noScale”;
myXML=newxml();
myXML.ignoreWhite=true;
myXML.onLoad=函数(){
nodes=myXML.childNodes;
// ----------------------
//查找第一个图像
// ----------------------
如果(topimage.length){
对于(变量i=0;i-1){
load(“gallery.php”);
//}否则{
//load(“gallery.xml”);
//}
停止();
2.
System.security.loadPolicyFile(“http://photos.googleapis.com/data/crossdomain.xml"); 
System.security.allowDomain(“*”);
功能图轮廓(mc、宽度、高度){
var wallx=宽度/2+10;
var wally=高度/2+10;
var偏移=4;
//影子
mc.beginll(0x000000,20);
mc.移动到(-wallx+偏移,-wally+偏移);
mc.lineTo(墙X+偏移,-墙Y+偏移);
mc.lineTo(墙X+偏移,墙Y+偏移);
mc.lineTo(-wallx+偏移,wally+偏移);
mc.lineTo(-wallx+偏移,-wally+偏移);
//轮廓
mc.beginll(0xFFFFFF,100);
mc.lineStyle(2x333100);
mc.移动到(-wallx,-wally);
mc.lineTo(wallx,-wally);
司令官莱恩托(沃克斯,沃利);
mc.lineTo(-wallx,wally);
mc.lineTo(-wallx,-wally);
mc.endFill();
}
// ----------------------
//生成占位符
// ----------------------
载荷=[];
堆栈=[];
深度=9999;
对于(i=0;i覆盖)?img.\u宽度:覆盖;
封面高度=(图片高度>封面高度)?图片高度:封面高度;
img._旋转=(Math.random()*16)-8;
img._visible=假;
img._α=0;
堆栈推送(img);
载荷。推力(img);
}
堆栈[0]。_旋转=0;
gox=(总W/节点长度)*0.9;
goy=(-totalh/节点长度)*0.4;
// ----------------------
//加载图像
// ----------------------
函数loadimage(id){
如果(加载[id]){
加载[id]。_visible=true;
加载[id].imgholder.loadMovie(加载[id].imgholder.src);
加载[id].imgholder.onLoad=函数(){
加载[id].imgholder.onEnterFrame=函数(){

如果(这是._parent._alpha当您直接从flash ide运行它时,它能工作吗?在这种情况下,您几乎可以肯定这是一个权限/安全问题,flash完全拒绝加载图像。如果它也不能直接从flash ide工作,我建议使用一些跟踪语句打印它加载的图像的URL您可以检查它们是否被正确解析(或者使用调试器实现相同的解析).

好的,所以我决定从我遇到麻烦的旧AS 1.1脚本开始,最终只购买了。它拥有完成项目所需的一切。感谢您的回答,我非常感谢。

实际上,它在ide或本地主机上不起作用,但我可以在服务器上运行。我可以像以前一样加载图像只要它们在同一台主机上,这就是为什么我会认为这是一个权限/安全问题。例如,它将本地绝对引用传递给图像,但当我尝试传递外部图像时,它会中断。我不确定如何跟踪();以找到它传递给文件的url(新手)。谢谢!好的,所以我创建了一个在IDE中工作的新版本。我还进行了跟踪并确认url的位置正确。我非常激动,直到我意识到加载[id]。imgholder.onLoad=function()当电影剪辑尝试从其他根域加载远程图像时,该图像为空。抱歉,我没有任何其他建议。如果它在IDE中工作,您知道如果您获得正确的权限,应该可以使其工作(特别是允许你的flash下载东西的外部服务器-但看起来谷歌的还可以),所以我只能说:继续尝试。只是为了澄清一下。我让它在IDE中只使用本地文件工作,但从未能够从Picasa获得远程图像加载到flash中。感谢你花时间研究这个问题!
System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); 
System.security.allowDomain("*");

MovieClip.prototype.addProperty("onLoad", function () {
    return __onLoadHandler__[this];
}, function (f) {
    if (__onLoadHandler__ == undefined) {
        _global.__onLoadHandler__ = {};
    }
    __onLoadHandler__[this] = f;
});
Math.easeInQuad = function(t, b, c, d) {
    return c*(t /= d)*t+b;
};
Math.easeOutQuad = function(t, b, c, d) {
    return -c*(t /= d)*(t-2)+b;
};
Stage.scaleMode = "noScale";
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {
    nodes = myXML.childNodes;
    // ----------------------
    // find first image
    // ----------------------
    if (topimage.length) {
        for (var i = 0; i<nodes.length; i++) {
            if (nodes[i].attributes.src == topimage) {
                var insert = nodes.slice(0, i);
                nodes.splice(0, i);
                nodes = nodes.concat(insert);
            }
        }
    }
    _root.gotoAndStop(2);
};
//if (_url.indexOf("http")>-1) {
myXML.load("gallery.php");
//} else {
//  myXML.load("gallery.xml");
//}
stop();
System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); 
System.security.allowDomain("*");

function drawOutline(mc, width, height) {
    var wallx = width/2+10;
    var wally = height/2+10;
    var offset = 4;
    // Shadow
    mc.beginFill(0x000000, 20);
    mc.moveTo(-wallx+offset, -wally+offset);
    mc.lineTo(wallx+offset, -wally+offset);
    mc.lineTo(wallx+offset, wally+offset);
    mc.lineTo(-wallx+offset, wally+offset);
    mc.lineTo(-wallx+offset, -wally+offset);
    // Outline
    mc.beginFill(0xFFFFFF, 100);
    mc.lineStyle(2, 0x333333, 100);
    mc.moveTo(-wallx, -wally);
    mc.lineTo(wallx, -wally);
    mc.lineTo(wallx, wally);
    mc.lineTo(-wallx, wally);
    mc.lineTo(-wallx, -wally);
    mc.endFill();
}
// ----------------------
// build placeholders
// ----------------------
loads = [];
stack = [];
depth = 9999;
for (i=0; i<nodes.length; i++) {
    attrs = nodes[i].attributes;
    img = _root.createEmptyMovieClip("image"+i, depth--);
    drawOutline(img, attrs.width, attrs.height);
    img.createEmptyMovieClip("imgholder", 1);
    img.imgholder._x = -attrs.width/2;
    img.imgholder._y = -attrs.height/2;
    img.imgholder.src = attrs.src;
    totalw += img._width;
    totalh += img._height;
    coverw = (img._width>coverw) ? img._width : coverw;
    coverh = (img._height>coverh) ? img._height : coverh;
    img._rotation = (Math.random()*16)-8;
    img._visible = false;
    img._alpha = 0;
    stack.push(img);
    loads.push(img);
}
stack[0]._rotation = 0;
gox = (totalw/nodes.length)*0.9;
goy = (-totalh/nodes.length)*0.4;
// ----------------------
// load images
// ----------------------
function loadimage(id) {
    if (loads[id]) {
        loads[id]._visible = true;
        loads[id].imgholder.loadMovie(loads[id].imgholder.src);
        loads[id].imgholder.onLoad = function() {
            loads[id].imgholder.onEnterFrame = function() {
                if (this._parent._alpha<75) {
                    this._parent._alpha += 25;
                } else if (this._parent._alpha<100) {
                    this._parent._alpha += 25;
                    loadimage(id+1);
                } else {
                    delete this.onEnterFrame;
                }
            };
        };
    }
}
loadimage(0);
// ----------------------
// handle swap
// ----------------------
_root.createEmptyMovieClip("Cover", 10000);
Cover.beginFill(0xFFFFFFF, 0);
Cover.moveTo(-coverw/2, -coverh/2);
Cover.lineTo(coverw/2, -coverh/2);
Cover.lineTo(coverw/2, coverh/2);
Cover.lineTo(-coverw/2, coverh/2);
Cover.lineTo(-coverw/2, -coverh/2);
Cover.endFill();
Cover.onRelease = function() {
    // Shuffle the top image to the side
    stack[0].t = 0;
    stack[0].rot = stack[0]._rotation;
    stack[0].changerot = (Math.random()*16)-8-stack[0].rot;
    stack[0].onEnterFrame = function() {
        this.t++;
        this._x = Math.easeInQuad(this.t, 0, gox, 6);
        this._y = Math.easeInQuad(this.t, 0, goy, 6);
        this._rotation = Math.easeInQuad(this.t, this.rot, this.changerot, 6);
        if (this.t == 7) {
            this.swapDepths(depth--);
            this.t = 0;
            this.onEnterFrame = function() {
                this.t++;
                this._x = Math.easeOutQuad(this.t, gox, -gox, 6);
                this._y = Math.easeOutQuad(this.t, goy, -goy, 6);
                if (this.t == 6) {
                    delete this.onEnterFrame;
                }
            };
        }
    };
    // Rotate the next image into view
    stack[1]._x = stack[1]._y=0;
    stack[1].t = 0;
    stack[1].rot = stack[1]._rotation;
    stack[1].onEnterFrame = function() {
        this.t++;
        this._rotation = Math.easeOutQuad(this.t, this.rot, -this.rot, 6);
        if (this.t == 6) {
            delete this.onEnterFrame;
        }
    };
    // Move top image to the back of the stack array
    var addback = stack.shift();
    stack.push(addback);
};