Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

dwilday

Members
  • Posts

    9
  • Joined

  • Last visited

dwilday's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm absolutely in favor of having a way to next prependURLs. Currently my structure looks like this: There are instances where I need to load individual items as well as entire groups. I never plan to load every item and every group at once but was planning to use the outer most LoaderMax as a way for the client to easily alter the main path for all of the swfs (which there may end up being quite a large number of). Being able to nest prependURLs would be nice. Not a "must have" but definitely convenient.
  2. Ahh I see where the error is. I'm using the URL to access the content of the image loader (since each document has a thumbnail with the name of "thumb"). While the image has been loaded it's url hasn't been modified. I just need to track whether I've modified my paths and manually add in the prepending string when I'm accessing the content. So, for example the following: var imagePath:String = pageXML.ImageLoader.(@name=="thumb").@url; var image:Bitmap = LoaderMax.getLoader( imagePath ).rawContent; will now become: var basePath:String = (useAlternatePath)?"../":""; var imagePath:String = pageXML.ImageLoader.(@name=="thumb").@url; var image:Bitmap = LoaderMax.getLoader( basePath + imagePath).rawContent;
  3. Is that supposed to prepend the URL of even the ImageLoader classes within the XML? Currently it doesn't seem to be doing that. I'll give it another go and double check the errors I was getting, but I believe it wasn't touching the URLs of the deepest nested ImageLoader nodes. Honestly I may be doing something wrong here.
  4. Wow, thanks for the quick update! Unfortunately, for my particular situation I'm still stuck using the onRawLoad event. Since this only works on XMLLoaders my lower level ImageLoaders are left with incorrect urls.
  5. Valid points all. The reason it doesn't work in my scenario is that multiple XML files are being loaded, all with the same structure. To keep them each self contained and easily maintainable the name attribute of the nodes are identical... so if I query the root LoaderMax instance for a specific item the URL is the logical choice in my instance. I guess I'll just use my workaround, it's not that huge of an issue. I'm not sure I agree with your example as being a bad scenario. If the method name was "getLoaderByUrl()" then, yes by all means it should be the original url. I actually think that the real issue is that you're changing the return value of the loader.url to loader.alternateURL. To me it almost makes more sense to have a third attribute, say actualURL. But really that's just my take on it. All in all this is a very handy class! Thanks for all your hard work.
  6. My current solution is to add an onRawLoad callback that does the following: public function onRawLoadComplete(e:LoaderEvent):void { if ( useAlternatePath ) { var loaders:XMLList = XML(e.target.content)..*.(localName() == "ImageLoader" || localName() == "XMLLoader"); for each(var loader:XML in loaders) loader.@url = "../" + loader.@url; } } It seems to be holding up for now though if there's a more straightforward way of performing this function I'd love to know about it.
  7. Here's the loading code I'm using: var loader:LoaderMaX = new LoaderMax({name:"mainLoader", onComplete:onLoadComplete, onProgress:onLoadProgress}); loader.append( new SelfLoader(this)); loader.append( new XMLLoader(mainXMLPath, {name:"xml/application.xml"})); loader.append( new XMLLoader(gamesXMLPath, {name:"xml/games.xml"})); if ( useAlternatePath ) { loader.prependURLs("../", true); } loader.load(); The following is the sample content of my the games.xml file: <?xml version="1.0"?> This then loads a separate XML file for each page... which is generally in the format: <?xml version="1.0"?> Title goes here 20 … As you can probably see I'm trying to load all of the content (down to the images in the game1.xml & game2.xml files). Since the location is changed based on logic within the code I'd want to modify all of the base paths, but not hard code the append into the XML. If you still need a sample FLA I can whip one up for you.
  8. I'm having a bit of trouble with this. I have a config xml that contains XMLLoader nodes with their load attribute set to true. Inside the children I have a few ImageLoader nodes that are also set load. Is there any way to add a basepath that will run throughout the entire structure? My employers have a system in place that needs to publish one file that will work both internally and for the client. To do that they generally have a var at that checks certain parameters and modifies the basepath. I'm trying to phase out their loader (which is quite convoluted and often fails) with LoaderMax. So far it's been going pretty well, except for this one feature. I tried prepending the basepath in the onComplete as the previous poster had suggested but since this is an action that needs to happen before it completes it does not work. Any suggestions?
  9. I'm new to working with LoaderMax so I'm testing out a bunch of possibilities to make sure there aren't major failures when we push this project to a server. In doing so I've found something that isn't working the way I would hope. Basically when I call getLoader() on a LoaderMax instance and pass it the URL for the item I wish to load it will return null if it's alternateURL is what was actually used to load the item. As the alternateURL won't get called unless the regular URL fails I'd expect that by passing the url I should get whichever file has loaded. While I know I could use the name function for just this purpose it doesn't make much sense in my scenario. My current workaround is to check to see if the loader.getLoader(url_path) != null before deciding which one to use. Is this the recommended way of going about this or is there a simpler path that will just yield the image I'm looking for?
×