| How to Load an External MP3 from a Text Input Box | Return to Index | Do you want all FLA's used for this tutorial? | Do you have a question? |
If you want to be able to type in the file name of an MP3 file into a text box, and press a button to have that file play, the following could be used:
|
on(press) { |
![]() |
|
| on (press) { //Stop Button if (_root.playing==true) { _root.playing=false; _root.paused=false; _root.stopped=true; _root.myInputSound.stop(); _root.myInputSoundPosition=0; _root.myInputSoundPositionText=0; } } |
This is one case in which you have to break the rule of defining all sound objects in the same location. When the button is pressed, the value of "songInput" is inserted during the sound object definition.
| on (press) { if (_root.playing!=true) { _root.playing=true; _root.paused=false; _root.stopped=false; if (_root.stopped==true) { _root.myInputSound.start(0,0); } else _root.myInputSound.start(_root.myMusicPosition,0); } } |
This document copyright © 2004 by Kenny Bellew of Cowfly.Com Design, kennybellew@hotmail.com