使用ActionScript 3连接到数据库连接到、数据库、ActionScript

2023-09-08 11:34:43 作者:烟酒为伴

我在寻找建议基于数据库如何动态地创建Flash内容。最初,我在想,我们的数据库中导出到一个XML文件,并使用内置的ActionScript XML解析器照顾的,但是XML文件的大小可能证明望而却步。

我已阅读有关使用一个中间步骤(PHP,ASP)来检索信息,并传回的一些动作脚本可以读,但我会preFER不这样做,如果可能的。已经与 asSQL 库之前工作过的人?还是有别的东西,我很想念?

解决方案

除非你在服务器端(我怀疑)运行您的ActionScript,连接到数据库,直接将不会是非常聪明的。要连接到从客户端数据库的动作,你就必须打开你的服务器,以接受来自大家的数据库连接,并且你必须存储访问数据的SWF文件中,这将是一个灾难性的结合,以防有人拆开瑞士法郎文件。

如果该XML的大小是望而却步,你总能以某种方式分拆它,或者如果它是不可能的,你可以通过PHP或其他任何服务器上运行的从服务器获取数据,例如,你会给在该请求到PHP文件和服务器端脚本然后相关参数查询数据库,生成的XML文本(即完整的数据的一个子集,基于给定的参数),其可以被ActionScript被消耗掉。

I'm looking for advice on how to dynamically create content in flash based on a database. Initially I was thinking that we would export the database to an XML file and use the built in Actionscript XML parser to take care of that, however the size of the XML file may prove prohibitive.

同问客户机无法连接到sql2008的数据库,求解

I have read about using an intermediary step (PHP, ASP) to retrieve information and pass it back as something that Actionscript can read, but I would prefer not to do that if possible. Has anyone worked with the asSQL libraries before? Or is there something else that I am missing?

解决方案

Unless you're running your Actionscript on the server side (I doubt that), connecting to a database directly wouldn't be very smart at all. To connect to a database from client side Actionscript you'd have to open your server to accept database connections from everyone, and you'd have to store access data in your swf files and that would be a disastrous combination in case someone disassembles the swf files.

If the size of the XML is prohibitive, you can always split it somehow, or if it is impossible, you can get the data from the server through PHP or anything else running on the server, for example, you'd give the relevant parameters in the request to the PHP file and the server side script then queries the database, builds XML text (that is a subset of the complete data, based on the given parameters) that can be consumed by the Actionscript.