I have some older AS2-style Haxe code which uses flash.Lib.Current.CreateEmptyMovieClip() to create a slideshow of disk-based images. It creates a new clip for holding each image and simply fades each image in and out with alpha levels.
Compiling it with -swf -swf-version 8 creates an SWF file fine and this works in the browser.
However, I’m in the process to converting this over to -swf9 and I find that the MovieClip no longer has that method.
How do you load up a series of images with Haxe (AS3-style)?
The code, for what it’s worth, is along these lines:
static function main() {
mc = flash.Lib.current;
var clip : MovieClip;
clip = mc.createEmptyMovieClip ("clip_000", mc.getNextHighestDepth());
clip.loadMovie ("demo_img000.jpg");
: : :
You can just create a new display object w/o linking it to a clip in the library like this:
You can then add it to another display object by using the
addChild()method:The above line will add the new clip to the top of the display list, just like using
getNextHighestDepth().If you want to add a clip a depth between two other clips you can use:
As for loading an image, loadMovie does not exist in AS3. You need to use the Loader and URLRequest objects like this: