2010-06-05 24 views

回答

0

您需要使用server side scripting语言,例如PHP。

Flash会向服务器发送请求(PHP文件),服务器端脚本将检索相关信息并将其发送回Flash。然后你可以用Flash从你想做的事情做起。

有关ActionScript 3.0的更多帮助,请查看forums at www.kirupa.com

如果你只是想将文件加载到Flash(如图像)来显示它,请试试这个Actionscript。只需复制并将其放到“动作”面板中即可。 (从我的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

所以我也必须有一个PHP脚本,我不能只是用一个Flash文件做? Flash文件是否可以将PHP脚本提取到服务器? – flashnoob 2010-06-05 15:22:17

+0

正确的需要PHP。 Flash是“客户端”,不能直接与服务器通信。我不完全确定你的意思是提取。如果你的意思是把PHP代码放在Flash文件中,那是行不通的。查看“URLLoader”和“URLRequest”的Actionscript 3规范。这些将允许您从服务器加载PHP文件。然而,在将其加载到Flash文件之前,PHP脚本将检索您指示它在其代码中执行的任何操作。 – 2010-06-05 15:25:39

+0

这有道理吗? – 2010-06-05 15:26:08

相关问题