【发布时间】:2016-05-14 18:32:11
【问题描述】:
我的 URL 请求在 Flash Pro 中运行良好,但是当我在浏览器中对其进行测试时,图像根本无法运行。它不加载。我需要使用发布设置吗?
请帮忙,这很令人沮丧。 Here's 在浏览器中的样子。
相关代码:
public function startSlidingPuzzle() {
// blank spot is the bottom right
blankPoint = new Point(numPiecesHoriz-1,numPiecesVert-1);
// load the bitmap
loadBitmap("http://fc07.deviantart.net/fs71/f/2014/030/d/7/slidingimage_by_nooodisaster-d74et6t.jpg");
}
// get the bitmap from an external source
public function loadBitmap(bitmapFile:String) {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingDone);
var request:URLRequest = new URLRequest(bitmapFile);
loader.load(request);
}
// bitmap done loading, cut into pieces
public function loadingDone(event:Event):void {
// create new image to hold loaded bitmap
var image:Bitmap = Bitmap(event.target.loader.content);
pieceWidth = image.width/numPiecesHoriz;
pieceHeight = image.height/numPiecesVert;
trace(numPiecesHoriz)
// cut into puzzle pieces
makePuzzlePieces(image.bitmapData);
// shuffle them
shufflePuzzlePieces();
}
【问题讨论】:
-
Flash 无法从托管它的 Web 服务器以外的 Web 服务器加载数据,除非目标服务器上存在有效的跨域策略。阅读更多:-adobe.com/devnet/flashplayer/articles/cross_domain_policy.html
-
这个答案对我帮助很大,同样的问题stackoverflow.com/questions/13131638/…
标签: actionscript-3 flash urlrequest