Hi guys,
I’m making a Flash website and having some trouble with my XML gallery & Music player.
Start with the gallery as I think that’s simplest to fix. When I run the gallery out of my website it works absolutely fine, but when I load it in using a UL Loader it won’t cycle through the images it only cycles through the captions.
The Music Player, I’m using this code:
import fl.events.SliderEvent;
//create instances of the three sound related classes that will be used for this project
var snd:Sound;
var channel:SoundChannel;
var trans:SoundTransform;
//create variables to store values for the current song and it's volume and pan settings.
var currSong:String;
var currVol:Number = .5;
// Array of all the songs in the current playlist.
var songList:Array=new Array("song1.mp3" , "song2.mp3" , "song3.mp3" , "song4.mp3");
//Listeners for the onstage song buttons
song1.addEventListener(MouseEvent.CLICK, chooseSong);
song2.addEventListener(MouseEvent.CLICK, chooseSong);
song3.addEventListener(MouseEvent.CLICK, chooseSong);
song4.addEventListener(MouseEvent.CLICK, chooseSong);
//listeners for the volume and pan sliders
volSlide.addEventListener(SliderEvent.CHANGE, volumeChange);
//sets the text field of all of the song buttons to display the names of the songs in the songList array
for (var i = 0; i < songList.length; i++) {
var str:String = songList* as String;
str = str.replace(".mp3","");
var clip = this["song" + (i + 1)].title;
clip.text = str;
}
//switch statement to set the current song based on which song button was clicked.
function chooseSong(e:MouseEvent):void {
switch (e.currentTarget.name) {
case "song1":
currSong = "/"+songList[0] as String;
break;
case "song2":
currSong = "/"+songList[1] as String;
break;
case "song3":
currSong = "/"+songList[2] as String;
break;
case "song4":
currSong = "/"+songList[3] as String;
break;
}
if (snd != null) {
channel.stop();
}
snd = new Sound();
snd.load(new URLRequest(currSong));
channel = new SoundChannel ;
trans = new SoundTransform(currVol);
channel = snd.play();
channel.soundTransform = trans;
volSlide.visible = true;
//currVolume and pan values are used here for display in the text fields next to sliders
//listens for arrival of ID3 tags
snd.addEventListener(Event.ID3, id3Handler);
}
//triggered when id3 tags are available
//sets info text field to display current song information from id3 tags.
function id3Handler(event:Event):void {
var id3:ID3Info = snd.id3;
if (id3.songName != null) {
songTitle.text = id3.songName;
albumTitle.text= id3.artist;
}
}
// uses volume slider value to control volume
function volumeChange(e:SliderEvent):void {
currVol = e.target.value;
trans.volume = currVol;
channel.soundTransform = trans;
}
But when I try and run it I get this error:
[INDENT]ReferenceError: Error #1069: Property title not found on flash.display.SimpleButton and there is no default value.
at musicplayer_fla::MainTimeline/frame1()[musicplayer_fla.MainTimeline::frame1:107][/INDENT]
Any ideas as to what could be causing that?