0

I'm trying to get a picture, requiring htaccess login. I know the username and the password, but when I try to log with them in the url it returns:

Error opening URL 'http://85.217.***.***/image.jpg?cachebust=0&a=0' SecurityError: Error #2000: No active security context.

However, when I open the published swf via flashplayer it asks me for username and password. Not the same in the browser. How can I log in the server? Here is my code: ` package {

import flash.display.MovieClip;
import flash.net.URLRequest;

import flash.utils.*;

import flash.display.Loader;

public class Camera extends MovieClip {

    public function Camera() {

        setInterval(callImage, 500);

    }       

    private function callImage():void {

        var imageLoader:Loader = new Loader();

        var image:URLRequest = new URLRequest("http://85.217.***.***/image.jpg?cachebust="+Math.floor(Math.random())+"&a=0");

        imageLoader.load(image);

        addChild (imageLoader);

    }

}

} `

Emil Avramov
  • 753
  • 5
  • 16
  • 32
  • 1
    http://stackoverflow.com/questions/6588769/as3-using-a-loader-to-load-a-file-protected-by-htaccess – AsTheWormTurns Jan 21 '12 at 14:04
  • 1
    have a look here... [http://stackoverflow.com/questions/509219/flex-3-how-to-support-http-authentication-urlrequest][1] [1]: http://stackoverflow.com/questions/509219/flex-3-how-to-support-http-authentication-urlrequest – Dirk Leuther Jan 21 '12 at 14:04
  • 1
    BTW your cachebusting code will always produce a 0, which entirely defeats the purpose. Either leave out the Math.floor or better yet use the current time in milliseconds. "?cachebust=" + new Date().getTime() – Creynders Jan 21 '12 at 14:10

0 Answers0