Sound.duration
683
The following example loads several songs into a SWF file. A progress bar, created using the
Drawing API, displays the loading progress. When the music starts and completes loading,
information writes to the log file. Add the following ActionScript to your FLA or AS file.
var pb_height:Number = 10;
var pb_width:Number = 100;
var pb:MovieClip = this.createEmptyMovieClip("progressBar_mc",
this.getNextHighestDepth());
pb.createEmptyMovieClip("bar_mc", pb.getNextHighestDepth());
pb.createEmptyMovieClip("vBar_mc", pb.getNextHighestDepth());
pb.createEmptyMovieClip("stroke_mc", pb.getNextHighestDepth());
pb.createTextField("pos_txt", pb.getNextHighestDepth(), 0, pb_height,
pb_width, 22);
pb._x = 100;
pb._y = 100;
with (pb.bar_mc) {
beginFill(0x00FF00);
moveTo(0, 0);
lineTo(pb_width, 0);
lineTo(pb_width, pb_height);
lineTo(0, pb_height);
lineTo(0, 0);
endFill();
_xscale = 0;
}
with (pb.vBar_mc) {
lineStyle(1, 0x000000);
moveTo(0, 0);
lineTo(0, pb_height);
}
with (pb.stroke_mc) {
lineStyle(3, 0x000000);
moveTo(0, 0);
lineTo(pb_width, 0);
lineTo(pb_width, pb_height);
lineTo(0, pb_height);
lineTo(0, 0);
}
var my_interval:Number;
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
if (success) {
trace("sound loaded");
}
};
my_sound.onSoundComplete = function() {
clearInterval(my_interval);
trace("Cleared interval");
}
my_sound.loadSound("song3.mp3", true);
my_interval = setInterval(updateProgressBar, 100, my_sound);
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...