Jump to content
Search Community

ggritmon

Members
  • Posts

    45
  • Joined

  • Last visited

About ggritmon

  • Birthday 08/24/1979

Profile Information

  • Location
    NY/NJ

ggritmon's Achievements

0

Reputation

  1. Thanks. I wasn't aware that modifying an XMLList would update the origin XML. That helped a lot! Final method looks like this: private function _onRawLoad(e:LoaderEvent):void { _log.trace("onRawLoad") var url:String; var xmlList:XMLList = e.target.content..@url; for each (var node:XML in xmlList) { i++; url = node.parent().@url; url = StringUtils.format(url, { lang:profile.language, quality:profile.quality } ); node.parent().@url = url; } }
  2. Update: Essentially what I want to do is replace any instances of @lang@ in my XML to the user's selected language. Example: <ImageLoader url="@lang@/imagefile.jpg"> should become: <ImageLoader url="en/imagefile.jpg"> I've got the following listener, but it throws an error when I try to write the XML content back to the XMLLoader. private function _onRawLoad(e:LoaderEvent):void { var raw:String = (e.target.content as XML).toXMLString(); raw = StringUtils.format(raw, { lang:"ENGLISH" } ); e.target.content = new XML(raw); } Please advise.
  3. I agree that putting it in PrependURLs may not be the appropriate place. The location where the final URL is assembled and attempts to be loaded is really where it should go, as part of the 'assembly' process.
  4. If you prepend "../../", it would do just that, and subloaded assets would load from 2 levels above. The "../" replacement is conditional. Essentially, if "../" is found anywhere in a URL after another directory, it is removed along with the preceding directory. How the "../" got there is irrelevant. it's just another level of validation to the URL. The example I listed above would work in both cases.
  5. All this change does is apply relative paths when they are prepended with absolute paths. They wouldn't be removed, they would be applied (for each "../", the folder before it is stripped out). If your XML contains relative paths, then reason would stand that they are relative to the asset loading the XML, and should still apply even if some absolute location has been specified. Do you disagree? Otherwise, this means the locations of assets in one place differs from the other (assets which used to be relatively outside this folder location are now within it?)
  6. When nesting loaders in an XMLLoader, I can use prependURLs to modify the location in which the assets are loaded. Unfortunately, if "../" was part of the URL path, the result is an invalid path. // example: inside data/assets.xml <SoundLoader url="../shared/sound1.mp3"> w/ prependURLs "http://foo.com/game/", this becomes: "http://foo.com/game/../shared/sound1.mp3" when it should be: "http://foo.com/shared/sound1.mp3" I was able to resolve this issue with an update to the LoaderMax.prependURLs method: public function prependURLs(prependText:String, includeNested:Boolean=false):void { var loaders:Array = getChildren(includeNested, true); var i:int = loaders.length; while (--i > -1) { LoaderItem(loaders[i]).url = validatePath(prependText + LoaderItem(loaders[i]).url); } } protected function validatePath(path:String):String { var i:int, j:int; do { i = path.indexOf("../"); if (i > -1) { j = path.lastIndexOf("/", i - 2); if (j > -1) path = path.substr(0, j + 1) + path.substr(i + 3); } }while (i > -1 && j > -1) return path; }
  7. I have an XMLLoader which loads an XML containing 2 LoaderMax objects, one with load="true" and one with load="false". When the XMLLoader triggers onComplete, I start my app and want to request the second LoaderMax to start. When I do this, however, the assets never seem to start loading. Am I calling things correctly? // XML <GameAssets> <LoaderMax name="Subload" load="false" childrenVars="autoPlay:false"> <VideoLoader url="videos/Main/M1.f4v" name="M1MainAnimation" autoDispose="false" /> </LoaderMax> </GameAssets> // AS3 private function _onLoadComplete(e:LoaderEvent):void { trace("ASSETS LOADED"); var subLoader:LoaderMax = LoaderMax.getLoader("Subload"); subLoader.vars = { onProgress:onSubloadProgress } subLoader.load(); } private function onSubloadProgress(e:LoaderEvent):void { trace("THIS NEVER HAPPENS?"); }
  8. I'm sorry, but now I can't reproduce the issue (before I even copy this new version over). Did Adobe decide to finally resolve this issue in FP 11 or something? Now when I call rawContent.clear() it works perfectly fine. I looked at the new clearVideo() method & it looks like it would do the trick nicely (assuming the user is in a player which demonstrates the problem?)
  9. I have an app where relative loading is not an option. Instead, I use recursivePrependURLs with the absolute location of the files specified in the XML loaded via XMLLoader. Unfortunately, some file locations include the '../', which when combined with a recursivePrependURL is invalid example: prependURL="http://www.foo.com/widgets/" asset URL = "../images/bar.jpg" expected result = "http://www.foo.com/images/bar.jpg" actual result = "http://www.foo.com/widgets/../images/bar.jpg" I've written a validator on my end which scans for ../ in the middle of a URL and removes the preceding folder, but am not sure where I would have an opportunity to modify the embedded URL from the XML before LoaderMax begins loading it. Could you please advise on when I'd have an opportunity to modify the URL at runtime before loading, or perhaps add support for this case in a future version of the library?
  10. Sorry, not sure what you mean by 'be in my GreenSock account". I'm not a Club Greensock member, and am unsure where else you may be referring to.
  11. Is there anything yet which highlights the new features/improvements of v12?
  12. Can't wait for v12. Sounds like the custom easing class would be a good solution.
×
×
  • Create New...