View Single Post
  #4 (permalink)  
Old May 22nd, 2007, 15:28
Sgaspar11 Sgaspar11 is offline
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: automating a tedius navigational task

Hey, well - not a stupid question....and not sure I know the answer from that standpoint but I can tell you how I do it with an XML file to maybe spark your thoughts...

I set my array in flash and a few other variables I needed for the player:

Code: Select all
//Currently Playing Song
var cps:Number = -1; //sets up songs to play in order starting with  first
//Position of Music
var pos:Number;
//array of Songs
var sa:Array = new Array();
I load in the XML file: songs.xml

Code: Select all
 
//Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
 var nodes:Array = this.firstChild.childNodes; //puts the xml file into the array
 for(var i=0;i<nodes.length;i++); //starts first song and itterates from there
 {
  sa.push(nodes[i].attributes.url); //grabs the url of the song
 }
 playSong(); //function to play the songs
}
xml.load("songs.xml");
And the playSong(); function that plays each song.

Code: Select all
function playSong():Void
{
 s = new Sound();
 if(cps == sa.length -1)
 {
  cps = 0;
  s.loadSound(sa[cps], true);
 }
 else
 {
  s.loadSound(sa[++cps], true);
 }
 playPause.gotoAndStop("pause");
}
This is the concept. Then in the XML file I could give each song a name and telll it to play the specifc song from the xml file on the click of the name of the song from the playlist.

This would be the same with your buttons I would think. Then you would maybe need to give each symbol a name(or number) and then tell you array to place them in the specific order listed (1,2,3,4)? I don't know...

Not sure if this helps, but there ya have it.

Last edited by Sgaspar11; May 22nd, 2007 at 15:31.
Reply With Quote