Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Z0OTY

URLRequestDefaults or something similar?

Recommended Posts

Hi,

I love using Greensock classes. I am currently using LoaderMax for everything!

 

I wanted to know if it was possible to load images from a password protected folder on the server (htaccess protection)?

 

I was researching

URLRequestDefaults.setLoginCredentialsForHost();

but it looks as if that is only for AIR and Flash Lite 4.

 

Or is there a way to send variables to a php script using ImageLoader to retrieve the file?

 

Any suggestions?

Edited by Z0OTY
Link to comment
Share on other sites

I'm not aware of a way to have an ImageLoader log in and access password-protected assets, no. You can, however, send data to the server with the request if you want - see the FAQ section of the main LoaderMax page for an example. http://www.greensock.com/loadermax/

Link to comment
Share on other sites

  • 1 month later...

Playing with the URLRequests and ran into a problem with loading videos:

  • I have a PHP script that accepts the URLVariables from AS3 to pull a file from a folder.
  • The PHP then sets the proper headers for the file (in this case .flv)
  • The VideoLoader DOESN'T load the video and throws an error saying NetStream.Play.StreamNotFound.

Everything kind of works with music and photos, they sometimes don't load. Videos do not load at all no matter the type.

I can go to the PHP page in browser and the video loads in the browser just fine, but when I try to load it in flash, I get that error. Any ideas?
Link to comment
Share on other sites

It sure sounds like the problem is on the server side there. Have you removed VideoLoader from the equation just for testing purposes and used a plain NetStream to load your video?

Link to comment
Share on other sites

Yup, the video loads fine any other way, even using VideoLoader with a regular string for the URL. It only fails to load once there are variables involved and sending it to a PHP.

 

//shortened AS3 code
var request:URLRequest = new URLRequest("http://www.domain.com/my.php");
var data:URLVariables = new URLVariables();
data.one = "1234";
data.two = "video.flv";
request.data = data;
request.method = URLRequestMethod.POST;
vidLoader = new VideoLoader(request, {name:"video", container:this, autoPlay:true, volume:1, estimatedBytes:750000});
vidLoader.load();

 

 

The PHP then locates a the "video.flv" file in folder "1234" and appropriates the headers and reads the file. Works for mp3s and images.

Link to comment
Share on other sites

When you say "the video loads fine any other way", are you saying you tried with a regular NetStream apart from VideoLoader, INCLUDING the extra variables? I'm pretty sure you can't do it because of the way NetStream works (it doesn't use a URLRequest - it only accepts a String as a url parameter). Unless my memory is failing me which is entirely possible because it's 3am and I'm pretty sleep-deprived :)

Link to comment
Share on other sites

Ahhh I see what you mean. I just tried it. So I guess there is no way around this then huh?

Link to comment
Share on other sites

Not that I know of, no.

Link to comment
Share on other sites

Would DataLoader work in this situation?

Link to comment
Share on other sites

You can send data to the server with DataLoader, yes, but that doesn't help with a NetStream that's required for video playback in Flash. Sorry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×