有没有人遇到过这个?我设置了 crossdomain.xml,我还尝试将本地播放设置为仅网络,但仍然没有运气。
我要做的是让用户上传一张图片,然后我通过 PHP 传递该值并创建一个目录。之后点击它返回路径,我尝试将图像加载为缩略图,这就是我收到安全错误的时候。
//frOne is my fileReference variable.
function oneSelected(e:Event)
{
trace("\nName: " + e.target.name);
trace("\nSize: " + e.target.size);
frOne.upload(uploadURL);
getImage(frOne.name);
}
function getImage(imgName:String)
{
phpVars.imagename = imgName;
phpReq.data = phpVars;
phpLoader.addEventListener(Event.COMPLETE, phpImage);
phpLoader.dataFormat = URLLoaderDataFormat.TEXT;
phpLoader.load(phpReq);
phpReq2.method = URLRequestMethod.POST;
trace('send the info');
}
function phpImage(e:Event)
{
testString = phpLoader2.data;
var decoded:String = decodeURI(testString);
testString = decoded;
var imgLoader:Loader = new Loader();
imgLoader.load(new URLRequest(testString.slice(0,testString.length) + frOne.name));
addChild(imgLoader);
}
我得到的错误
http://url/bwljagvsbgv6enjhdghlcnl5ymniz3p6y29t/images/Winter.jpg
*** Security Sandbox Violation ***
Connection to
http://url/bwljagvsbgv6enjhdghlcnl5ymniz3p6y29t/images/Winter.jpg
halted - not permitted from file:///Z|/mydirectory/myswf.swf
SecurityError: Error #2147: Forbidden protocol in URL
http://url/bwljagvsbgv6enjhdghlcnl5ymniz3p6y29t/images/Winter.jpg.
at flash.display::Loader/flash.display:Loader::_load()
at flash.display::Loader/load()
at BCBGen_fla::MainTimeline/loadImage()
at BCBGen_fla::MainTimeline/fnImageTimer()
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()