自定义头像并保存到数据库
我是闪存新手。我愿意为注册用户制作一个自定义头像,其中的配件将保存在数据库中。该项目将从数据库中提取到 flas,并且在用户完成创建他的头像后,该项目将保存在数据库中。我的意思是我的头像应用程序将像使用 flash、php 和 mysql 定制的 farmville 头像一样。我正在寻找这个解决方案。请帮我!
I am new in flash. I am willing to make a customize avatar for a registered user where the accessories will be save in a database. The item will be pulled from database to flas and after the user finished creating his avatar this will be save in the database. I mean my avatar application will be as like as farmville avatar customizetion using flash,php and mysql. I am fadeing up to find this solution. Please help me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案取决于您的编辑器有多大。您可以在 Google 代码上找到 Senologies 制作的头像编辑器的一个很好的示例:
http://code.google.com/p/myavatareditor/
这应该可以帮助您开始闪光灯部分。我建议您解析编辑器中所做的选择并将其保存为字符串或 JSON。这将使以后添加额外的功能变得容易。当用户下次登录时,您只需从数据库加载并解析保存的编辑器数据并构建正确的头像。
编辑:
了解如何将 AS3 与 PHP 和 MySQL 一起使用:
http://www.gotoandlearn.com/play.php?id=20
The solution depends on how big your editor will be. There is a nice example of an avatar editor made by Senocular that you can find on Google Code:
http://code.google.com/p/myavatareditor/
This should get you started with the flash part. I recommend that you parse the selections made in the editor and save it as a string or maybe JSON. This will make it easy to add extra features later. When the user login the next time you just load and parse the saved editor data from the database and build the correct avatar.
EDIT:
Find out how to use AS3 with PHP and MySQL:
http://www.gotoandlearn.com/play.php?id=20
不久前我在博客上写了一篇关于 如何从 Flash ActionScript3 在服务器上存储 Jpg 图像。全部都是西班牙语(当然,实际编码除外),但也许通过谷歌翻译(或其他一些翻译服务)你就能够理解它。
步骤是:
1) 在 MovieClip 上使用
BitmapData.draw()
(在您的例子中,是自定义的头像)2) 使用
JPGEncoder
,将其二进制数据存储在 < code>ByteArray3) 使用
URLRequest
,URLLoader
将二进制数据发送到 PHP4) 在 PHP 脚本中,接收二进制数据并执行任何操作 (
写入
将其保存为文件以将其存储为图像文件,或将其作为 blob 存储在数据库中)5) 利润!
希望这有帮助!
I wrote on my blog not too long ago a post about how to store Jpg images on server from Flash ActionScript3. It's all in Spanish (except for the actual coding, of course), but maybe with Google Translate (or some other translation service) you'd be able to follow it.
The steps are:
1) Use
BitmapData.draw()
on the MovieClip (in your case, the customized avatar)2) Using
JPGEncoder
, store its binary data in aByteArray
3) Send the binary data to PHP with
URLRequest
,URLLoader
4) In PHP script, receive the binary data and do whatever (
fwrite
it to a file to store it as a image file, or store in a database as a blob)5) Profit!
Hope this helps!