I am in some serious need of some help. Oh, and I need some assistance writing code too.
I’ve created what is a vector replication of the face of a stereo receiver. Essentially what I have done so far is that the “power” button on the receiver “turns on” the receiver. Basically it jumps to a new frame and displays a movie clip that shows welcome text scrolling along the LED of the receiver. The code I wrote works fine:
stop();
power_btn.addEventListener(MouseEvent.CLICK,clickListener1);
function clickListener1(event:MouseEvent):void {
gotoAndStop(“poweron”)
}
Now that the power is “on”, the 6 buttons (I am using to play my 6 favorite songs) can be pressed. I have probably tried 5 or 6 different variations on the code and nothing works. I was originally able to embed the songs in Flash (bad idea… made my file 200 MB), but at least they played. They didn’t stop when I clicked a new button, but it halfway worked.
The better way is to load them externally. But I am not able to find code that works, nor do I know enough about AS3 to know how to do this. Basically, I need to write script that will play a song (loaded from an external source, same source folder as the .fla file), then stop and play the a different song when a new button is pressed.
Everything is on the main timeline.
I’ve found this code, but it’s not working.
var snd:Sound;
var channel:SoundChannel;
var trans:SoundTransform;
// Array of all the songs in the current playlist.
var songList:Array=new Array(“metallica.mp3”,“audioslave.mp3”,“ledzeppelin.mp3”,“soundgarden.mp3”,“stones.mp3”,“greenday.mp3”);
fav1music1.addEventListener(MouseEvent.CLICK,clickListener1);
function clickListener1(event:MouseEvent):void {
gotoAndStop(“tunes”)
}