2 crazy questions about dynamic loading

Question numero 1:
I made an mp3 interface that controls a song from the library. All of the functions use that linkage name since there is only one song there. If I want to load mp3s dynamically how can I adjust the functions so they can be applied to any mp3 instead of just tweaking the function for each mp3?

Question # 2:
I have have the same situation with loading external text files. How do I assign a variable that can be used to get the text files name so I can use the same function? I am using this type of code:
loadText = new loadVars();
I need to assign a variable for the text file’s name.

thanks a million flash geniuses.

this example has two sounds they are dynamically attached, and loaded… you can control each individual sound, or you can work with the global sound.

[swf=“http://www.sacreations.co.za/images/flash/sounds.swf height=400 width=400”][/swf]

you can get the fla file at http://www.sacreations.co.za/images/flash/sound.zip

if you have any problems you can let me know and i will e-mail the file to you…

loadVariables(“madonnaAL.txt”, _root);

this is the script i used to load the variables from a text file. its a frame script.

i used that script in my footer :slight_smile:

I have an interface that I want to be able to control multiple mp3s with the same script; for instance, the same pause button. I want the interface to be able to manipulate any possible song.

as for the text question I think I could somehow do it with an array. I will try it but if I can’t get it I will need one of you flashmasters to help me out. thanks homeboys

:sleep: word

the only other thing i can think of is an extension you can download off the macromedia website.

it is a component for working with sound. all you have to do it create an xml page that will contain a listing of the mp3’s you wish to use. all the mp3’s are external and loaded when needed.

you can stream the music or just upload the full song before you playing.

Hello brian, or is it Mr. Monkey?

First things first.

Please post your current code or an fla(preferred). I will not be able to tell you how to adjust your code without seeing it first. :wink:

text files. Do you already know the name of your text files. Do you simply want to add a text file and have flash recognize that it exists? I need to know more information about how you intend this to work. Again, the code would be helpful.

actually I prefer brian2. I solved the text problem using an array! yay!!!

here is the .fla. I plan on loading .mp3s though so the .fla is a little different than what I want. I need to know how to adjust the actionscript for that but I am not sure how. I hope that is clear enough.

thank you a billion times

shoot. my .fla is too big so I took out the sound file. imagine that there is one in there.

thanks markcq! do you have anymore information on this component or a link? how much it costs?


here is a tut i put together for someone else that wanted the xml mp3 player… by the way… the component is free!!!

you can get the component at: http://www.macromedia.com/cfusion/exchange/index.cfm

– click flash exchange

– open the categories drop down list - select audio & video

– download the audio set component

– double click the downloaded file to install it…

– it will be available in your components panel

ok, i’m no xml expert, but this worked for me, so i’m just giving you the steps as i went about with it… like i said… mine worked like a bomb! :player:

the xml version you also have volume control and it will show the precentage loaded. if you are going to have full tracks i might suggest that you stream it instead. at least people can listen while it downloads… else you should just warn people that they might have to wait a while for each track to load…

here we go:

1 put all the mp3’s you wanna use in one directory

2 using notepad/dreamweaver create the xml page… my example:

< ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " U T F - 8 " ? >
< a u d i o F i l e s >
< A u d i o P r o p s p a t h = " a l i f e . m p 3 " s o n g T i t l e = " m a d o n n a - a m e r i c a n l i f e " / >
< A u d i o P r o p s p a t h = " b g i r l . m p 3 " s o n g T i t l e = " m a d o n n a - b a d g i r l l i v e " / >
< A u d i o P r o p s p a t h = " b b b a b y . m p 3 " s o n g T i t l e = " m a d o n n a - b y e b y e b a b y ( h o u s e m i x ) " / >
< A u d i o P r o p s p a t h = " D Y K n o w . m p 3 " s o n g T i t l e = " m a d o n n a - D o n ’ t Y o u K n o w " / >
< A u d i o P r o p s p a t h = " f e v e r . m p 3 " s o n g T i t l e = " m a d o n n a - f e v e r v i d e o v e r s i o n " / >
< A u d i o P r o p s p a t h = " G G G o n e . m p 3 " s o n g T i t l e = " M a d o n n a - G o n e G o n e G o n e ( d e m o ’ 9 7 ) " / >
< A u d i o P r o p s p a t h = " l e t d y g u a r d . m p 3 " s o n g T i t l e = " m a d o n n a - l e t d o w n y o u r g u a r d ( r o u g h m i x e d i t ) " / >
< / a u d i o F i l e s >

this is all you need in the document. its not an html page so you don’t need any other html tags. all you have to change is the AudioProps path (where the file is and the file name… we are going to save the xml page in the same directory as the mp3’s so there should not be any problems… check to see if your files have upper or lower case names… what i did was copy the name of the original file and then just paste it in the xml… at least i know i can’t make a mistake with spelling). the other thing you have to change is the songTitle (this is what the person will see when they open your mp3 player…)

3 save the xml page in the same directory as the mp3’s… call it “audiopath.xml”

4 now go to flash

5 components - audio set - xmlMp3playerSC (double click)

6 select the component on the stage

7 change any settings in the properties - parameters that you want to change…
stream (true or false)
status (what people will see when nothing is playing)
playlist (the name of your xml page)

8 save the fla in the same directory as the mp3’s and the audiopath.xml file

9 ctrl enter (to test your movie & to publish the swf file)

10 file - publish settings - select html and flash, and press the publish button… this will create a html page with the swf file on…

11 if you use dreamweaver you might want to do this manually… just press the insert flash button and insert the swf file.

12 when uploading this to the internet you must upload all the mp3’s, the xml page, the swf, and the html page

that’s about it… your 12 steps to happiness. LOL


brian… hope this works for you. if all else fails, just scream for help again :stuck_out_tongue:

I will try this right away!

thanks again, brian2