Solved

How do I call variables into Flash by removing existing XML calls?

Posted on 2007-11-19
1
217 Views
Last Modified: 2008-02-07
We have a flash audio player that currently uses an XML file to bring in data (audio path, image location, title) for the audio file.  Rather than having one XML file for each audio file (we have a lot), I'd like to pull the details of each audio file (by PHP) through the URL string.


With PHP I can pull the following variables into the actionscript, but I dont know what elements of the XML to replace?

var projectaudio:String;
var projecttitle:String;
var projectimage:String;

Below is the current actionscript and XML:



Here is the current actionscript:
 
_root.playlist == undefined ? playlist = "mp3player.xml" : playlist=_root.playlist;
 
// stage variables
Stage.showMenu = false;
Stage.scaleMode = "noScale";
stop();
 
// player variables
volume = 100;
current_audio = 1;
top.equalizer._visible=0;
 
// playlist loading
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);
 
 
// parsing all xml data into flash
function loadData(success) {
	if (success) {
		imgloc = this.firstChild.attributes.imgloc;
		// showdisplay and playlist toggles
		if (this.firstChild.attributes.showTime != "yes"){
			top.timecomponent._visible = 0;
		}
		showDisplay = this.firstChild.attributes.showDisplay;
		if (showDisplay == "yes") {
			top.easeY(toppos);
			topup = false;
			display_btn._rotation+=180; }
		showPlaylist = this.firstChild.attributes.showPlaylist;
		if (showPlaylist == "yes") {
			bot.easeY(botpos);
			botup = false;
			list_btn._rotation+=180; }
		// getting all titles and filenames
		aPath = new Array();
		audioTitel = new Array();
		audioTracks = new Array();
		audioTracks.shuffle();
		audioTracks = this.firstChild.childNodes;
		audio_total = audioTracks.length;		
		for (var i = 0; i<audio_total; i++) {
			aPath.push(audioTracks[i].attributes.path);
			audioTitel.push(audioTracks[i].attributes.title);
			// buiding playlist buttons
			bot.playlist.btn.duplicateMovieClip("btn"+i, i);
			bot.playlist["btn"+i]._y = bot.playlist.btn._y+i*int(bot.playlist.btn._height) +i;
			bot.playlist["btn"+i].txt = checkDigits(i+1)+". "+audioTitel[i];
			bot.playlist["btn"+i].hit.onPress = function() {
				listClick(this._parent.getDepth()+1); }; 
		}
		//checking autostart mode
		autoStart = this.firstChild.attributes.autoStart;
		if (autoStart == "yes") {
			playaudio(); 
			play_btn._visible = 0;
		} else if (autoStart == "no") {
			play_btn._visible = 1;
			pause_btn._visible = 0;
		} else if (autoStart == "random") {
			current_audio = random(audio_total)+1;
			playaudio(); 
			play_btn._visible = 0;
		} else {
			current_audio = int(this.firstChild.attributes.autoStart);
			playaudio(); 
			play_btn._visible = 0; } }
	// done ! all loaded succesfully. purging trash
	//load company image
	loadMovie(imgloc,"container");
	//
	delete audioTracks;
	delete data_xml;}
 
 
 
Here is the XML file:
 
<?xml version="1.0" encoding="UTF-8"?>
<player showTime="no" autoStart="yes" imgloc="testing.jpg">
    <audio path="http://www.url.com/testing.mp3" title="Testing Audio" />
</player>
 
 
 
//////////////////////////////////////////////////////////////////////////

Open in new window

0
Comment
Question by:citegirl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
ID: 20314723
Why not have the php file generate the xml data. This way you have alot more flexibility then passing the variables through the url

_root.playlist == undefined ? playlist = "mp3player.php" : playlist=_root.playlist;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The goal of the tutorial is to teach the user how to how to record live broadcast.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question