dominic_r_monroe -> Flash: JukeBox without XML - Collab'ed With Althorne (9/3/2008 13:58:03)
|
Welcome, This is my tutorial for making a jukebox. After reading Althorne's tutorial I noticed that the sound quality was unfortunately Lowered. So after a while of searching I discovered some AS2 Code that would help ! quote:
//FRAME ACTIONS var songID:String; //Declares the variable SongID a string value (text and numbers) songInfo = new Array(); //Declares the variable songInfo an array //ALL KEYS MUST BE DIFFERENT, BUT VALUES CAN BE THE SAME!! songInfo["Key"] = "Value"; //An Example Value in the array with the key 'Key'. Duplicate the line, and change the key to one you like. Change the value on the variable to the FILENAME of your mp3 WITHOUT THE .mp3 loadSong=function(songID){ //Declares loadSong a function. When the function is run, a value for the variable SongID stopAllSounds(); //Stops ALL Sounds loadedSong = new Sound(soundLoader); //The variable loadedSong is a new sound. When a sound is loaded into it, it is given the instance name soundLoader loadedSong.loadSound(songInfo[songID] + '.mp3', true); //Loads a song into the variable loadedSong. The name of the file is songInfo[theKeyYouGiveInTheButton] and it adds the string .mp3 to the end. } //Ends the statement block The script is pretty Much Self Explanitory. Add this to the frame. On a new layer called Actionscipt //BUTTON ACTIONS quote:
on (release) { //Executes The Following Block of Code When The Mouse Is Clicked loadSong("Key"); //Runs the loadSong() function that is declared in frame 1. The "Key" refers to the key declared in the array on frame 1. Look there for full description } //Ends code block Yet again Very Self-Explanatory. Thanks to Althorne. He pretty Much just Array Versioned my script. :L. Key = Song Name Value = Name of .mp3.mp3 n the end is not required. Now test your jukebox by hitting Control + Enter. Before exporting in flash. If wanted you could Add colours and other wonderful effects. I may Make an equalizer bar tutorial using the Mask Feature at a point. But until Then Good Luck. Export as .swf. And put in the FOLDER Containg .swf and Music files Notes: Now make sure the Sound files are in the same folder as the swf file. Remeber to rename nameofsongfile.mp3 from the code to what the .mp3 file is E.g Glamorous-LudacrisFtFergie.mp3. If you try and upload The swf alone it will not work ! You must upload the folder. I know that BiG Frend was doing free hostin not long ago, contact him for details. I will try and get my Jukebox up somewhere on the internet. I am planning on getting a new site. Thanks to Althorne for contributing his Arrays Etc. TO my Tutorial !
|
|
|
|