Jump to content
Search Community

ggritmon

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by ggritmon

  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.
  13. I was thinking the call would parse the array into the separate .to calls (like you said can already be done) rather than store the array and have conditional logic on every frame. But I see what you're saying, regarding the need for more customizability. What if it there was instead a way to store presets, something like: // Create a custom ease var customEase:Array = [] // Start by Strong.easeOut animating 60% of the way over 1/4 the duration customEase.push({ease:Strong.easeOut, start:0, end:.6, duration:.25}) // Next, animate back to 40% of the way over 1/2 of the duration customEase.push({ease:Regular.easeNone, start:.6, end:.4, duration:.5}) // Finish by Strong.easeIn animating to 100% of the way over 1/4 the duration customEase.push({ease:Strong.easeIn, start:.4, end:1, duration:.25}) /* Standard TweenMax.to call, but with the customEase applied. the to() method detects the custom ease, and parses it into separate TweenMax.to calls by applying the multipliers to the duration and target values. */ TweenMax.to(mc, 2, {x:300,y:300,ease:customEase} /* Parses to (assuming x & y start at 0): TweenMax.to(mc, .5, {x:180,y:180,ease:Strong.easeOut} TweenMax.to(mc, 1, {x:120,y:120,ease:Regular.easeNone, delay:0.5} TweenMax.to(mc, .5, {x:300,y:300,ease:Strong.easeIn, delay:1.5} */
  14. I think it would be neat if you could pass multiple ease types to TweenMax.to, something like: mc.x = mc.y = 0; // Example 1: Elastic ease in to 150:150 over 1.5 seconds... // ...followed by Strong ease out to 300:300 over 1.5 seconds TweenMax.to(mc, 3, {x:300, y:300, ease:[Elastic.easeIn, Strong.easeOut]}); // Example 2: Strong ease in to 150:150 over 1.5 seconds... // ...followed by Strong ease out to 300:300 over 1.5 seconds TweenMax.to(mc, 3, {x:300, y:300, ease:[strong.easeOut, Strong.easeIn]}); // Example 3: Strong ease in to 100:100 over 1 second... // ...followed by Linear ease to 200:200 over 1 second... // ...followed by Strong ease out to 300:300 over 1 second TweenMax.to(mc, 3, {x:300, y:300, ease:[strong.easeIn, Linear.easeInOut, Strong.easeOut]});
  15. Looks like there is an even simpler solution, found here: https://bugs.adobe.com/jira/browse/ASC-3115 "...just set video.smoothing=false before you call clear and the video is cleared. You'll then need to set it back to true when you reuse it."
  16. When I show a video on start, the last frame of that video displays for a split second since that is the current data until the Video refreshes. Normally, Video.clear() would be the fix for that, but... ...there is a known bug with Video.clear(), logged in the Adobe system & never getting fixed: https://bugs.adobe.com/jira/browse/FP-178 The workaround seems to be either: show & hide video (which doesn't help since showing the video on start still displays the last frame) or: when clear() is called, destroy & reinstantiate the Video instance. It would be great if the VideoLoader had a clear() method which did the second point above.
  17. I think this will work. With this, I would need to have different LoaderMax nodes for each type of Loader, right? Since I may want SWFLoaders to noCache=true but not ImageLoaders.
  18. Or, in keeping with the LoaderMax syntax, something more like: VideoLoader.defaults = {noCache:true, autoPlay:false} SWFLoader.defaults = {context:child, noCache:true}
  19. I love how XMLLoader allows me to define additional assets to load within the XML file, but there is no way to override the default settings for each type, so I need to add the same properties over & over. For example, I am loading 100's of sounds & videos for use on demand. If I don't set autoPlay=false on every single corresponding node, everything starts to play immediately, shattering my eardrums It would be good if we could set the default values for these properties on some global level. If the corresponding node is not found, the default for that type would be used. SWFLoader.noCache = true; ImageLoader.smoothing = true; VideoLoader.autoPlay = false; Having this capability would dramatically simplify the required content of the XML file. Is there anything like this in the current system?
  20. I may have found a fix!!! I can't say whether or not there are side-effects, but I haven't found any yet. After loading all my assets (videos & sounds), I call SoundMixer.stopAll(); . This seems to free up the sound channels that were being held by the videos. So far, this doesn't seem to keep the video sound from playing when the video is playing. Please let me know if this fix works for you, or if you find any side-effects. Greensock, I'm not sure if the SoundChannel being held by video is a side-effect of Flash's native netStream stuff or something specific to VideoLoader, but it seems like this fix is the sort of thing that should be integrated into the LoaderMax library at some point.
  21. Thank you for this post. I was banging my head against the wall trying to figure out why, after a certain point, sounds stopped working. I'd rather not change the way I load and manage assets (I don't want to unload & reload videos as I need them to play instantly upon request). Is the Sound Channel limitation only active sound channels? Is there a way, perhaps, to free up the video sound channels unless the video is actively playing?
×
×
  • Create New...