Jump to content
Search Community

MP3Loader - alternative URL

rob_v_5712 test
Moderator Tag

Recommended Posts

Im just curious if there is any way to have a failover type URL for MP3loader?
 

Here is the situation I have.

My folders look like this.....

deploy
+-assets
  +-swfs
  +-audio

In the deploy folder - I have a player.swf file that will play the swfs in the assets/swfs folder.

 

One of those swfs loads an XML file - in that XML file there is an entry for MP3Loader that will load an audio file in deploy/assets/audio folder

 

When I develop the swf in the IDE - the path for the audio is ../audio  when I run it from the player, it see the path as ./assets/audio.

 

I can't use full paths b/c these will eventually live on a server - so they need to be relative paths.

 

So right now - when Im in the ide - I mod the XML to point to ../audio  and when I test it in the player - I mod the XML to ./assets/audio

 

Is there any easier way to handle this.  If there was a way to define an alternate URL - that would be perfect.  

 

Just curious if anyone has run into this before and how did you handle it.

 

Thanks

 

Link to comment
Share on other sites

Yeah, those changing paths are really annoying. 

Its been awhile but one technique I used was detecting the player type using code like this:

http://snipplr.com/view/55102/

 

Based on what environment the swf was running in I would prepend the proper path segment to the url.

 

If you are using XMLLoader you can then use its prependURLs special property:

 

prependURLs : String - A String that should be prepended to all parsed LoaderMax-related loader URLs (from nodes like <ImageLoader>, <XMLLoader>, etc.) as soon as the XML has been parsed. For example, if your XML has the following node: <ImageLoader url="1.jpg" /> and prependURLs is set to "../images/", then the ImageLoader's url will end up being "../images/1.jpg". prependURLs affects ALL parsed loaders in the XML. However, if you have an <XMLLoader> node inside your XML that also loads another XML doc and you'd like to recursively prepend all of the URLs in this loader's XML as well as the subloading one and all of its children, use recursivePrependURLs instead ofprependURLs.

 

http://api.greensock.com/as/com/greensock/loading/XMLLoader.html

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...