热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用Actionscript3连接到数据库-UsingActionscript3toconnecttoadatabase

Imlookingforadviceonhowtodynamicallycreatecontentinflashbasedonadatabase.Initially

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.

我正在寻找有关如何基于数据库在Flash中动态创建内容的建议。最初我认为我们会将数据库导出到XML文件并使用内置的Actionscript XML解析器来处理这个问题,但XML文件的大小可能会令人望而却步。

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?

我已经阅读了有关使用中间步骤(PHP,ASP)来检索信息并将其作为Actionscript可以读取的内容传回的内容,但是如果可能的话,我宁愿不这样做。之前有没有人使用过asSQL库?或者还有其他我想念的东西?

7 个解决方案

#1


4  

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.

除非你在服务器端运行你的Actionscript(我怀疑),直接连接到数据库根本不会很聪明。要从客户端Actionscript连接到数据库,您必须打开服务器以接受来自每个人的数据库连接,并且您必须将访问数据存储在swf文件中,如果有人拆解swf,这将是一个灾难性的组合文件。

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.

如果XML的大小过高,您总是可以以某种方式拆分它,或者如果不可能,您可以通过PHP或服务器上运行的任何其他东西从服务器获取数据,例如,您将提供相关参数在对PHP文件和服务器端脚本的请求中,然后查询数据库,构建可以由Actionscript使用的XML文本(基于给定参数的完整数据的子集)。

#2


6  

If you plan to deploy your flash content to a website, you should use some sort of backend - otherwise you would have a potential security problem. I use remoting with AMFPHP, it has worked out really well.

如果您计划将Flash内容部署到网站,则应使用某种后端 - 否则您可能会遇到潜在的安全问题。我使用AMFPHP进行远程处理,效果非常好。

#3


1  

Use a server-side language like PHP w/MySQL to write a text file or XML file that Flash can understand. in turn, when sending variables use ActionScript to send the variables to a PHP form parser that loads it to the server.

使用PHP w / MySQL等服务器端语言编写Flash可以理解的文本文件或XML文件。反过来,当发送变量时,使用ActionScript将变量发送到PHP表单解析器,将其加载到服务器。

I don't have any examples to show you right now, but that would certainly be a workaround to getting FlashCon or some other product, and you can get started right away. Check out some XML and PHP code sites -- you'll probably run into someone who has already solved your problem.

我现在没有任何示例向您展示,但这肯定是获取FlashCon或其他产品的一种解决方法,您可以立即开始使用。查看一些XML和PHP代码站点 - 您可能遇到已经解决了问题的人。

#4


0  

The general practice that I've experienced is that if it's something like a config file or just a really small amount of data then you could probably get away with just having an XML file on the server with your SWF files.

我经历的一般做法是,如果它类似于配置文件或只是非常少量的数据,那么您可能只需在服务器上使用SWF文件获得XML文件即可。

If you want the data to be more dynamic or you anticipate changing it quite often I would definitely do as Nouveau has already said and use PHP or a similiar technology to output database queries into an XML structure for your flash to load.

如果您希望数据更加动态,或者您希望经常更改它,我肯定会这样做,因为Nouveau已经说过并使用PHP或类似技术将数据库查询输出到XML结构中以便加载闪存。

If there is a lot of data however and you are really noticing your program choking or lagging on loading up the XML in that format I would definitely recommend remoting like Kristian has suggested, AMFPHP seems to be one of the more popular choices.

如果有很多数据然而你真的注意到你的程序在以这种格式加载XML时会窒息或滞后我肯定会建议像Kristian建议的那样进行远程处理,AMFPHP似乎是更受欢迎的选择之一。

Check out grapefrukt's answer to another question about flash and database interaction
Does Adobe Flash support databases?

查看grapefrukt对另一个关于flash和数据库交互的问题的回答Adobe Flash是否支持数据库?

#5


0  

just in case someone doesn't know the guys at midnightcoders have also a robust way for remoting in flash

以防万一有人不知道midnightcoders中的人也有一个强大的方法来进行远程处理

#6


0  

you can also use swx format wich is an interesting project to send/receive data using swf's wrapers, i personally prefer amfphp but i just commented here for reference purposes

你也可以使用swx格式,这是一个有趣的项目,使用swf的包装发送/接收数据,我个人更喜欢amfphp但我只是在这里评论以供参考

#7


0  

Don't use client side Actionscript to connect directly to the database, unless you're comfortable with the idea of exposing your connection string to anyone.

不要使用客户端Actionscript直接连接到数据库,除非您对将连接字符串暴露给任何人的想法感到满意。

Use some server side logic to connect to the database instead.

使用某些服务器端逻辑来连接到数据库。


推荐阅读
  • 本文介绍了在使用Laravel和sqlsrv连接到SQL Server 2016时,如何在插入查询中使用输出子句,并返回所需的值。同时讨论了使用CreatedOn字段返回最近创建的行的解决方法以及使用Eloquent模型创建后,值正确插入数据库但没有返回uniqueidentifier字段的问题。最后给出了一个示例代码。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • 深入理解Kafka服务端请求队列中请求的处理
    本文深入分析了Kafka服务端请求队列中请求的处理过程,详细介绍了请求的封装和放入请求队列的过程,以及处理请求的线程池的创建和容量设置。通过场景分析、图示说明和源码分析,帮助读者更好地理解Kafka服务端的工作原理。 ... [详细]
  • Gitlab接入公司内部单点登录的安装和配置教程
    本文介绍了如何将公司内部的Gitlab系统接入单点登录服务,并提供了安装和配置的详细教程。通过使用oauth2协议,将原有的各子系统的独立登录统一迁移至单点登录。文章包括Gitlab的安装环境、版本号、编辑配置文件的步骤,并解决了在迁移过程中可能遇到的问题。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Python爬虫中使用正则表达式的方法和注意事项
    本文介绍了在Python爬虫中使用正则表达式的方法和注意事项。首先解释了爬虫的四个主要步骤,并强调了正则表达式在数据处理中的重要性。然后详细介绍了正则表达式的概念和用法,包括检索、替换和过滤文本的功能。同时提到了re模块是Python内置的用于处理正则表达式的模块,并给出了使用正则表达式时需要注意的特殊字符转义和原始字符串的用法。通过本文的学习,读者可以掌握在Python爬虫中使用正则表达式的技巧和方法。 ... [详细]
  • 解决.net项目中未注册“microsoft.ACE.oledb.12.0”提供程序的方法
    在开发.net项目中,通过microsoft.ACE.oledb读取excel文件信息时,报错“未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序”。本文提供了解决这个问题的方法,包括错误描述和代码示例。通过注册提供程序和修改连接字符串,可以成功读取excel文件信息。 ... [详细]
  • 本文介绍了一种轻巧方便的工具——集算器,通过使用集算器可以将文本日志变成结构化数据,然后可以使用SQL式查询。集算器利用集算语言的优点,将日志内容结构化为数据表结构,SPL支持直接对结构化的文件进行SQL查询,不再需要安装配置第三方数据库软件。本文还详细介绍了具体的实施过程。 ... [详细]
author-avatar
坏坏不贱_233
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有