createEmptyMovieClip(???mc_??? + depth, depth);
}
}
Loading an Image in Flash 9
The Loader class, part of the swf.display package, can load SWF, JPG, GIF, or PNG files. Note that
each time a request is created to reach a remote resource, the actual URI must be wrapped in an
URLRequest object; this permits a finer grain control over the parameters of the request.
import flash.Lib;
import flash.display.Loader;
import flash.net.URLRequest;
class Main
{
public static function main()
{
var loader = new Loader();
loader.load(new URLRequest(???picture.jpg???));
Lib.current.addChild(loader);
}
}
Chapter 12: Building Interactive Content with Flash
325
Sounds
Loading sounds is very easy in every Flash version; the supported sound format is the industry
standard MP3.
Loading a Sound in Flash 6 to 8
The Sound class is in the flash package and it uses the loadSound() method to load a file. The sound
stream starts as soon as the player begins to receive bytes if the second argument is set to true ;
otherwise it will not automatically play and the sound can only be reproduced after the complete load
using the method start() .
Pages:
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636