I have been attempting to create a music player on my website in which you can choose the song you want to listen to you. Also I am making it so once you choose that song it will store it in a SOL file so when you launch the site again it will start playing the song you chose last time. Here's what I have for my first frame:
I have two buttons at the bottom for choosing the song. Button one:Code:local_data = SharedObject.getLocal("user_data"); stored_user_name = local_data.data.user_name; test.text = stored_user_name; if (stored_user_name=1) { mysound = new Sound(); mysound.attachSound("The Used - Blue and Yellow"); mysound.start(); } if (stored_user_name=2) { itsound = new Sound(); itsound.attachSound("Greenday - Holiday"); itsound.start(); }
And button two:Code:on (release) { local_data.data.user_name = 1; local_data.flush () }
Lastly I have a dynamic text field named "test" which displays the number chosen.Code:on (release) { local_data.data.user_name = 2 local_data.flush () }
What happens is when I start the flash, it plays both songs. Also if I were to click button two, the text field wont change to a 2 until the page is refreshed(since the number is stored in memory of the computer). So why won't it play one or the other? Did I make a mistake in the code?
In case you didn't notice, I use numbers to represent what song is supposed to be played. When they hit button 1, the number one is stored in memory and then it checks the if statement. If the number is 1, it plays the first song.




Reply With Quote