I've been trying to figure this out while im reinstalling flash(preview the work once and then wont let you do it again)
anyway what im trying to achieve is - AS reads a directory on a server lets say, it contains 10 images, this would create movie clips for each one and assign them to array "pockets"(im not sure if you can do this in AS, you can in PHP and JS so I'd expect so) then I'd use a repetitive function to manipulate each one of those images.
Could someone give 开发者_StackOverflowme some guidance? Thank you!
Try a combination of FlashVars
and scandir()
in PHP.
The process would basically be:
- Use
scandir()
(PHP) to generate a list of images in a directory. - Use
implode()
(PHP) to convert the list to a string. - Send the string to flash using FlashVars (HTML).
- Use
split()
(AS3) to convert your string back to a list of images. - Use the
Loader
class to add your images into the DisplayList.
Flash cannot read a directory directly, neither can client-side JavaScript. You need server side code to give you a directory listing, like PHP or Java or ASP.NET. Once you have the directory listing, you create an array and dynamically load the images into a movieclip.
Here's a tutorial on creating on loading images without using components.
http://flashexplained.com/actionscript/loading-external-jpgs-into-your-main-swf-movie/
It's easier with components, but whether or not you want to use them depends on your situation and requirements.
精彩评论