Jump to content
Search Community

Prepending a Url on a dynamic loaded loader.

SudoPlz test
Moderator Tag

Recommended Posts

I currently have an XML with MP3Loader inside.

 <LoaderMax name="ft$1:page$1" autoLoad="true">
      <MP3Loader name="aName" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
      <MP3Loader name="anotherName" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
 </LoaderMax>

I want to have different prepended a url on each of the MP3Loaders, but using

xmlLoader.prependURLs(aNewDirectoryPrepended,true); only prepends a Url in my XMLLoader and NOT on each Mp3Loader contained within the xml.

 

I found that to be correct because of this:

 

prependURLs() only affects loaders that are children of the LoaderMax when the method is called - it does not affect loaders that are inserted later.

 

 

Please read the next post:

Edited by SudoPlz
Link to comment
Share on other sites

Ok I found the recursivePrependURLs: property, and I ran my code again,

xmlLoader.append(new XMLLoader(curTaleDirectory+"/"+XML_FILENAME, 
{name:"taleName", 
recursivePrependURLs:curTaleDirectory, 
autoDispose :true }));

but now I get this error:

[trace] ---- 
[trace] Error on MP3Loader 'aName' (assets/defaultTale/page_1/backsound.mp3):
Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
[trace] ----
[trace] ----
[trace] Error on MP3Loader 'anotherName' (assets/defaultTale/page_1/backsound.mp3):
Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
[trace] ----

Hmm weird.. Am I doing something wrong, or is this a bug?

Link to comment
Share on other sites

From what you described it does not sound like recursivePrependURLs is necessary as described in the XMLLoader docs:

 

 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 of prependURLs.

 

 

Its difficult to trouble shoot these types of errors from mere code fragments.

 

Please provide a zip with the least amount of code and assets (xml, mp3s) necessary to reproduce the error.

 

Also it seems like you are loading the same sound twice. Curious if loading unique sounds helps as your error and situation seems a little similar to this one: http://www.actionscripterrors.com/?p=522

Link to comment
Share on other sites

Also it seems like you are loading the same sound twice. Curious if loading unique sounds helps as your error and situation seems a little similar to this one: http://www.actionscripterrors.com/?p=522

 

Hmm I changed that but still the same error.

 

Here is a simplified version of my code :

https://github.com/SudoPlz/testSoundLoadingLoadermax

 

My plan is this:

1) I load an XML which contains 2xMP3Loaders inside (with autoload=true),

2) I want to prepend a url on Runtime before they get loaded, otherwise the mp3s are not to be found.

Link to comment
Share on other sites

I noticed you are using autoLoad="true" on your LoaderMax in your xml

 

<LoaderMax name="ft$1:page$1" autoLoad="true">

 

autoLoad isn't a property recognized by LoaderMax. 

Can you try using 

<LoaderMax name="ft$1:page$1" load="true">

 

with prependURLs

 

In my local tests it worked as expected.

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...