Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,256 Programmers. There are 2,069 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Replacing xml relative link

 
Closed TopicStart new topic

Replacing xml relative link, Changing path to xml file

bmcc81
post 29 Apr, 2008 - 01:10 PM
Post #1


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70



Hi,

I made this MusicPlayer that use's XML files.

Check the player here so you can visually see what's up.

My html page sends a flash var to flash by the way of JavaScript.

In flash I use this to capture the FlashVar

CODE
text = "Label Copy";

But all this does is output it into a text box.

What I want that value to do is change my relative path in flash to where my xml document is.
This is my xml

CODE
xml.load("tracklist/songs.xml");


I want it so the variable I send ( say TC2_52869 ) gets sent to my xml.load


So,
CODE
xml.load("tracklist/TC2_52869.xml");


Can anyone help me out on finding out how to do this???

Thanks,

P.S. I plan on making a tutorial on how to do make this music player After I figure it all out
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


girasquid
post 29 Apr, 2008 - 07:01 PM
Post #2


Barbarbar

Group Icon
Joined: 3 Oct, 2006
Posts: 953

Just like I told you before, take a look at FlashVars - it will allow you to pass the absolute path(or relative if you prefer) into your SWF, so that it won't need to have the path hard-coded in.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

bmcc81
post 30 Apr, 2008 - 07:29 AM
Post #3


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70

QUOTE(girasquid @ 29 Apr, 2008 - 07:01 PM) *

Just like I told you before, take a look at FlashVars - it will allow you to pass the absolute path(or relative if you prefer) into your SWF, so that it won't need to have the path hard-coded in.



Thanks,

I was trying to over Complicate things. It works now, but the first song when I click on it doesn't load up. But after when I click the next song It will come.

CODE
stop();

// Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);

// Array of songs
var sa:Array = new Array();

// Currently playing song
var cps:Number = -1;

// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
    var nodes:Array = this.firstChild.childNodes;
    for(var i=0;i<nodes.length;i++)
    {
        sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track));
    }
    playSong();
}

trace(text);
xml.load(text);

function playSong():Void
{
    s = new Sound();
    s.onSoundComplete = playSong;
    s.setVolume(75);
    mute.gotoAndStop("on");
    if(cps == sa.length - 1)
    {
        cps = 0;
        s.loadSound(sa[cps].earl, true);
    }
    else
    {
        //s.loadSound(sa[++cps].earl, true);
    }
    trackInfo.text = sa[cps].track;
    playPause.gotoAndStop("pause");
    textPos = 0;
}


I get these errors when I test it. Mind you that _level0.text get's the value from JavaScript so that last error really works.

QUOTE
Error opening URL 'file:////Venus5/multimedia/Interactive/MMED%5F0025%20Elvis%20Collectable%20Tins/Xtras/Javascript%5FTalking%5Fto%5Fflash/undefined'
Error opening URL 'file:////Venus5/multimedia/Interactive/MMED%5F0025%20Elvis%20Collectable%20Tins/Xtras/Javascript%5FTalking%5Fto%5Fflash/_level0.text'


You can download it here


Is there a way to block this first error? or can anyone tell why it comes up?
Thanks,

This post has been edited by bmcc81: 30 Apr, 2008 - 10:30 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Closed TopicStart new topic
Time is now: 5/16/08 09:37AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month