将 Flash 连接到 PHPMyAdmin 数据库以显示数据
我有一个网站,其中索引页面上的内容由 PHPMyAdmin 数据库控制。我想要一个位于顶部的 Flash“电影”,它可以从网站获取数据,并以幻灯片方式显示它,直到用户单击特定链接,其中电影将直接指向单击的事件。
该页面适用于预订/促销音乐会公司。他们想要一个“精选节目”、“日历”和所有相互关联的 Flash 文件。一页。有谁知道如何做到这一点,在哪里可以找到教程,等等?请注意,我不想将数据写入数据库,我只想获取数据以发布到闪存文件上。
任何帮助将不胜感激!
I have a website in which the content on the index page is controlled by a PHPMyAdmin database. I want a a flash "movie" at the top, that can take the data from the site, and slide-show it until a user clicks on a specific link, in which the movie will direct itself to the clicked event.
The page is for a booking/promotion concert company. They want a "Featured Shows", "Calendar", and flash file that all are interconnected. One page. Does anyone know how to do this, where to find tutorials, or so on? Note, i'm not wanting to WRITE data to the database, I just want to GET data to post on the flash file.
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以读取php文件的内容,该文件将以XML格式返回数据库内容。
您可以在此处查看教程: http:// /www.flepstudio.org/forum/tutorials/2914-retrieve-data-mysql-flash-cs3.html
You could read the content of php file, which would return database content in XML format.
You can view a tutorial here : http://www.flepstudio.org/forum/tutorials/2914-retrieve-data-mysql-flash-cs3.html
Flash 可以执行远程处理,这基本上是 Flash 中 AJAX 类型行为的 Adobe 版本。
它有自己的数据格式,AMF(动作消息格式)。我使用 AMFPHP 作为必须使用 Adobe 自己的服务器的开源替代方案。有了这个,您可以(相对)轻松地向服务器发送数据或从服务器发送数据,并在两端自动将其转换为适当的 ActionScript 和 PHP 数据结构。
Flash can do Remoting, which is basically Adobe's version of AJAX-type behavior in Flash.
It has its own data format, AMF (action message format). I've used AMFPHP as an open source alternative to having to use Adobe's own servers. With this you can (relatively) easily send data to/from the server and have it automatically turned into the appropriate ActionScript and PHP data constructs on either end.
您的问题有两个步骤,第一个是从数据库中检索数据,第二个是如何格式化这些数据并在 Flash 中使用它。
就检索数据而言,常见的解决方案是使用 PHP。
您将需要一个 PHP 脚本来查询数据库、返回内容并格式化它。您应该在网上找到大量用于从数据库获取内容的教程。一旦你有了这个内容,你将需要给它某种形式的结构。就我个人而言,由于目标是在 Flash 中使用这些数据,我倾向于在 PHP 中创建“对象”,并使用 JSON 格式进行编码。这是个人喜好,很多人都使用XML。创建对象并对其进行编码后,我就可以将数据传递到 Flash。话又说回来,您应该找到很多关于如何构建数据库响应(XML 或 JSON 形式)的教程。
如果您计划在 Flash 中使用 JSON,则需要下载此库。
http://github.com/mikechambers/as3corelib
JSON 非常易于使用,您的对象已格式化作为一个字符串,在 Flash 中,您只需获取该字符串并执行
此操作即可返回一个具有您在 PHP 中设置的所有属性的对象。我发现这比遍历 XML 的所有节点更简单。
这个对象很可能是一个对象数组,例如每个对象都可以是一个“Show”,具有“date”、“location”、“venue_name”等属性......所有这些都必须在 PHP 中设置。
实际上,在 Flash 中,这些对象可以转换为类(例如 Show 类和 Calendar 类),然后您可以使用它们根据用户交互来显示信息以及相互之间的链接。
检查教程
- PHP/MySQL
- PHP 对象和json_encode() 或 PHP XML 输出
- Actionscript3 中的基本面向对象编程和类
- Flash / PHP 通信
网上有大量涉及这些主题的教程。
There are two steps with your question, the first one is to retrieve the data from your database, the second is how to format this data and use it in Flash.
As far as retrieving the data is concerned, a common solution is to use PHP.
You will need a PHP script that will query your database, return the content and format it. You should find plenty of tutorials on the net for getting the content from the database. Once you have this content , you will need to give it some form of structure. Personally, since the objective is to use this data in Flash , I tend to create "objects" in PHP which I encode with the JSON format. This is a personal preference, a lot of people use XML. Once the objects are created and encoded , I can then pass the data to Flash. Then again, you should find a lot of tutorials on how to structure the response from the database ,either as XML or JSON.
If you plan to use JSON in Flash, you will need to download this library.
http://github.com/mikechambers/as3corelib
JSON is very easy to use, your objects are formatted as a String and in Flash you simply need to take this String and do
This will return an object with all the properties that you've set in PHP. I find that more straightforward than having to go thru all the nodes of an XML.
It's very likely that this object , will be an Array of objects , each object could be a "Show" for instance , with properties such as "date" , "location" , "venue_name" etc... all these would have had to be set in PHP.
Practically, in Flash these objects can be turned into classes ( for instance a Show class and a Calendar class ) which you can then use to display your information an link with one another depending on user interaction.
Check tutorials on
- PHP/Mysql
- PHP objects & json_encode() or PHP XML output
- Basic Object Oriented Programming and classes in Actionscript3
- Flash / PHP communication
There are loads of tutorials on the net covering these subjects.