l.loadClip("http://www.helpexamples.com/flash/images/gallery1/images/pic3.jpg", image_mc);
为加载 MP3 文件创建进度条 创建一个名为 loadSound.fla 的新 Flash 文档。 在时间轴中选择第 1 帧,然后在"动作"面板中键入下面的代码: //设置宽高变量 var pb_height:Number = 10; var pb_width:Number = 100; //在影片剪辑pb中创建进度 var pb:MovieClip = this.createEmptyMovieClip("progressBar_mc", this.getNextHighestDepth()); //在影片剪辑pb中创建进度条 pb.createEmptyMovieClip("bar_mc", pb.getNextHighestDepth()); //在影片剪辑pb中创建进度条右边直线 pb.createEmptyMovieClip("vBar_mc", pb.getNextHighestDepth()); //在影片剪辑pb中创建进度框 pb.createEmptyMovieClip("stroke_mc", pb.getNextHighestDepth()); //在影片剪辑pb中创建动态文本 pb.createTextField("pos_txt", pb.getNextHighestDepth(), 0, pb_height, pb_width, 22); //影片剪辑pb的坐标设置 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("http://www.helpexamples.com/flash/sound/son |