Rudy
Rudy

Reputation: 29

AS3 Forbidden protocol in URL

Has anyone ever run into this before? I have the crossdomain.xml set and I've also tried setting the local playback to network only and still no luck.

What I'm trying to do is have the user upload an image, then I pass that value over through PHP and a directory is created. After that hits it returns with the path and I try to load the image as a thumbnail and thats when i get the security error.

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

error that I'm getting

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()

Upvotes: 0

Views: 3877

Answers (1)

Rudy
Rudy

Reputation: 29

problem solved. Needed to take out the http:// part of the string and the file loaded fine.

Upvotes: 2

Related Questions