-
HELP PLEASE!!!Sound Objects in Array!@#$%^
Somebody please tell me how to use sound objects in an Array.
This is so important and useful...yet I can't find a single clear answer anywhere. How do I define sound objects in an array so i can work with the list easily. The objects will be linked to external mp3s. THANKS THANKS THAnks
-
its not very clear from your question what you are trying to accomplish.
If you simply want to make an array element into a sound object...
sounds = new Array();
sounds[0] = new Sound(target path to unique mc);
-
UGH SOUND ARRAY...yes BUT!!!!!
if its that simple...why does this not work?
how do i call the item in the array when i actaully want to use it in a load sound command. It does not wark when written as below.
Doesn't a sound object need a name or does the array refernce become it's name. I'm so frustrated with this little /big problem.
please help me straighten this out..it's driving me nuts.
i want to be able to reference the external mp3's through the array so i can step through them with actionscript.
THANKS IN ADVANCE FOR YOUR THOUGHTS!
CHEERS
why doesn't this work?.....
_global.songs = new Array();
song[0]=new Sound("flash/music/mp3/home.mp3");
song[1]=new Sound("flash/music/mp3/celebration.mp3");
song[2]=new Sound("flash/music/mp3/roots.mp3");
on (release) {
loadsound(song[1],true);
}
-
hi,
try having the url's or the paths to the mp3 in an array as string. and then create a sound object and load the element of the array. this will solve your problem or so do I hope.
_global.songs = new Array();
song[0]="flash/music/mp3/home.mp3";
song[1]=flash/music/mp3/celebration.mp3";
song[2]="flash/music/mp3/roots.mp3";
on (release) {
mySound = new Sound();
mySound.loadSound(song[1],true);
}
also pay attention to the case of loadSound in your eg. you have given it as loadsound ... may be that is the problem
V E N K A T
~~~~~~~~~~~~~~~~~~~~~~~
BEGIN WITH END IN THE MIND
-
THANK YOU kindly....this works!...finally
Last question Please!!!! do i have to set it up like this????
DO I need to create the sound object every time i use it!
or just the one time?
also...can i create an array of the sound objects themselves ...if so how do i define an object inside an array and then call them up.
Does the loadSound command need to be prefaced by the definition of a sound. That is to say...if i define the sound objects inside the array...can i then just use the loadSound function?
BLAH BLAH BLAH...i know...sorry..i'm just trying to get my head around this !
THANKS A BILLION
for example..is this possible somehow
_global.song = new Array();
song[0]=new Sound("flash/music/mp3/home.mp3");
song[2]=new Sound("flash/music/mp3/home.mp3");
on (release) {
loadsound("song[2]",true);
}
-
you do not need to create the sound object on every button click. if you want to load an mp3 from a list:
Code:
// in root timeline
songList = new Array("urltosong1.mp3","urltosong2.mp3","urltosong3.mp3");
mp3Player = new Sound(this); // create the sound object once
// load first url from list, song1.mp3
on(release){
_root.mp3Player.loadSound(songList[0],true);
}
you might also take a look at the music and sound forum FAQ for code examples for loading previous and next song from a list, and random long.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|