2009-08-07 2 views
0

절대 경로를 사용하는 경우에도 원격 이미지를 플래시 사이드 쇼 로컬 파일로로드하려고합니다. 기존 갤러리를 업데이트하여 Picasa에서 이미지를 동적으로 가져옵니다.원격 이미지를 플래시 측면에로드하려고 시도합니다.

PHP는 제대로 작동하고 API에서 이미지를 가져옵니다. http://domaineseattle.com/gallery/FlashPhotoStack_SRC/gallery.php

하지만 XML을 플래시하면 원격 이미지가로드되지 않습니다.

나는 액션에
System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); 

을 추가하지만 여전히 작업을 실 거예요.

사이드 쇼의 서류는 다음과 같습니다

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

어떤 도움을 주시면 감사하겠습니다.

감사합니다.

답변

0

플래시 ide에서 직접 실행할 때 작동합니까? 이 경우 권한/보안 문제, 이미지로드를 거부하는 플래시가 거의 확실합니다. 또한 플래시 IDE에서 직접 작동하지 않는 경우 일부 추적 문을 이미지의 URL을 출력하여 해당 페이지가 실제로 구문 분석되는지 확인할 수 있도록하거나 디버거를 사용하여 해당 내용을 얻을 수 있는지 확인하는 것이 좋습니다. 같은).

+0

실제로 ide 또는 로컬 호스트에서 작동하지 않지만 서버에서 작동하도록 할 수 있습니다. 동일한 호스트에있는 한 이미지를 올바르게로드하므로 권한/보안 문제라고 믿게됩니다. 예는 http://domaineseattle.com/gallery/FlashPhotoStack_SRC/입니다. 로컬 절대 참조를 이미지로 전달하지만 외부 이미지를 전달하려고하면 끊어집니다. 추적 방법을 잘 모르겠습니다. 파일 (newbie)에 전달할 URL을 찾으십시오. 감사! –

+0

그래, IDE에서 작동하는 새 버전을 만들었습니다. 나는 또한 흔적을했고 URL이 정확한지 확인했다. 무비 클립이 다른 루트 도메인에서 원격 이미지를로드하려고하자마자 loaded [id] .imgholder.onLoad = function()이 비어있는 것을 알 때까지 너무 흥분했습니다. –

+0

죄송합니다, 더 이상 제안이 없습니다. IDE에서 작동하는 경우 사용 권한 (특히 외부 서버가 플래시를 다운로드하도록 허용하지만 Google이 좋아 보이는 것처럼 보일 수 있음)을 얻을 수있는 경우 작업을 수행 할 수 있음을 알 수 있습니다. 다음과 같이 말하십시오. –

0

좋아요. 그렇기 때문에 저는 이전 AS 1.1 스크립트에서 계속해서 문제가있어서 http://flash-gallery.com/stack-photo-gallery/을 구입했습니다. 프로젝트를 완료하는 데 필요한 모든 것이 있습니다. 답변 해 주셔서 감사합니다. 정말로 감사드립니다.

관련 문제