开发者

How to access server-side files in Flash

开发者 https://www.devze.com 2023-01-02 22:24 出处:网络
I\'m still a newbie at flash, but is it possible to have Flash get files from the server it is c开发者_开发问答urrently on, and then send those files somewhere?You need to use a server side scripting

I'm still a newbie at flash, but is it possible to have Flash get files from the server it is c开发者_开发问答urrently on, and then send those files somewhere?


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

精彩评论

暂无评论...
验证码 换一张
取 消