03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

with (pb.bar_mc) {<br />

beginFill(0x00FF00);<br />

moveTo(0, 0);<br />

lineTo(pb_width, 0);<br />

lineTo(pb_width, pb_height);<br />

lineTo(0, pb_height);<br />

lineTo(0, 0);<br />

endFill();<br />

_xscale = 0;<br />

}<br />

with (pb.vBar_mc) {<br />

lineStyle(1, 0x000000);<br />

moveTo(0, 0);<br />

lineTo(0, pb_height);<br />

}<br />

with (pb.stroke_mc) {<br />

lineStyle(3, 0x000000);<br />

moveTo(0, 0);<br />

lineTo(pb_width, 0);<br />

lineTo(pb_width, pb_height);<br />

lineTo(0, pb_height);<br />

lineTo(0, 0);<br />

}<br />

var my_interval:Number;<br />

var my_sound:Sound = new Sound();<br />

my_sound.onLoad = function(success:Boolean) {<br />

if (success) {<br />

trace("sound loaded");<br />

}<br />

};<br />

my_sound.onSoundComplete = function() {<br />

clearInterval(my_interval);<br />

trace("Cleared interval");<br />

}<br />

my_sound.loadSound("song3.mp3", true);<br />

my_interval = setInterval(updateProgressBar, 100, my_sound);<br />

function updateProgressBar(the_sound:Sound):Void {<br />

var pos:Number = Math.round(the_sound.position/the_sound.duration*100);<br />

pb.bar_mc._xscale = pos;<br />

pb.vBar_mc._x = pb.bar_mc._width;<br />

pb.pos_txt.text = pos+"%";<br />

}<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

1114 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!