开发者

Loading images into flash from directory

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:

  1. Use scandir() (PHP) to generate a list of images in a directory.
  2. Use implode() (PHP) to convert the list to a string.
  3. Send the string to flash using FlashVars (HTML).
  4. Use split() (AS3) to convert your string back to a list of images.
  5. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜