ActionScript 3.0 动态加载图像
我正在 Flash 中制作照片幻灯片,希望能够从文件夹动态加载图像。这样,每当我有一张新照片时,我都可以将其粘贴到一个文件夹中,并从该文件夹中读取我的 swf 文件并更新幻灯片。这在 ActionScript 3.0 中可行吗?如果是这样,任何指示都会有帮助。 谢谢!
I am making a photo slideshow in flash and would like to be able to load images dynamically from a folder. So that whenever i have a new photo i can just stick it in a folder and have my swf file read from that folder and update the slideshow. Is this doable in actionscript 3.0? if so any pointers would be helpful.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来这更像是服务器端逻辑而不是 Flash 逻辑。
您的 Flash 程序需要向服务器请求要加载的图像列表(服务器脚本将从目录中获取该列表)。您需要选择一种数据交换格式(纯文本(例如,每行一个文件名)或 XML,或任何您最容易使用的格式)。服务器脚本将以所选数据格式发回列表。然后,您的 Flash 程序将加载列表中的所有图像,并以幻灯片形式将它们呈现给用户。
问题中最棘手的部分是获取目录中的图像列表(取决于您在服务器端使用的语言,但应该不会太困难),以及让 Flash 与服务器异步通信(查看URLLoader)。
Sounds like this would be more server-side logic than Flash logic.
Your Flash program would need to ask the server for a list of images to load (which the server script would get from directory). You would need to choose a data exchange format (plain text (e.g. one filename per line), or XML, or whatever is easiest for you to work with). The server script would send back the list in the chosen data format. Then your Flash program would load all the images in the list, and present them to the user in a slideshow.
The trickiest parts of your problem would be getting the list of images in the directory (depends on which language you're using server-side, but shouldn't be too difficult), and getting Flash to communicate with the server asynchronously (check out URLLoader).