tags:

views:

15

answers:

1

I'm still a newbie at flash, but is it possible to have Flash get files from the server it is currently on, and then send those files somewhere?

A: 

You need to use a server side scripting language, such as PHP.

Flash would send a request to the server (PHP files), the server-side script will retrieve the relevant information and send it back to Flash. Then you can do what you want with it from Flash.

For help with ActionScript 3.0, look through the forums at www.kirupa.com.

If you simply want to load files into Flash (such as an image) to display it, try this Actionscript out. Just copy and past it into the Actions panel. (from my post on kirupa):

//Create instance of the Loader class
var loader:Loader = new Loader();
//Create instance of the URLRequest class and pass the URL as a string
var request:URLRequest = new URLRequest("myfile.jpg");
//Initiate the load process
loader.load(request);
//When the file finishes loading, the following will call addImageToMovieClip()
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, addImageToMovieClip);

function addImageToMovieClip(event:Event):void
{
  trace("Your loaded content is of type " + event.target.content);
  //Add the loaded content to the movieclip called "mc"
  mc.addChild(event.target.content);
}
letseatfood
So I also have to have a PHP script, I can't just do it with a flash file? Is it possible have the Flash file extract the PHP script to the server?
flashnoob
Correct about needing PHP. Flash is "client-side" and cannot directly communicate with the server. I'm not exactly sure what you mean by extract. If you mean put the PHP code in the Flash file, that would not work. Look into Actionscript 3 specs for `URLLoader` and `URLRequest`. These will allow you to load a PHP file from the server. Before it is loaded into the Flash file, though, the PHP script will retrieve whatever you instruct it to do in it's code.
letseatfood
Does that make sense?
letseatfood
Yah, thanks! Thats what I was looking for!
flashnoob
Great! Good luck :-)
letseatfood