From 7480630c3b00cf48ce71e7438ac0c456365941a0 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 7 Mar 2008 22:21:59 +0000 Subject: [PATCH] Touched up the examples. Added an example for the advanced case of loading classes at runtime. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4963 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/MultiLoader.as | 27 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/as/com/threerings/util/MultiLoader.as b/src/as/com/threerings/util/MultiLoader.as index 8cd470761..99c0f0053 100644 --- a/src/as/com/threerings/util/MultiLoader.as +++ b/src/as/com/threerings/util/MultiLoader.as @@ -48,17 +48,18 @@ public class MultiLoader * @param appDom the ApplicationDomain in which to load the contents, or null to specify * that it should load in a child of the current ApplicationDomain. * - * @example + * @example Load one embed, add it as a child. * * MultiLoader.getContents(EMBED_CONSTANT, addChild); * * - * @example + * @example Load 3 embeds, add them as children. * * MultiLoader.getContents([EMBED1, EMBED2, EMBED3], addChild, true); * * - * @example + * @example Load multiple URLs, have the contents returned to the result function one at + * a time. * * function handleComplete (result :Object) :void { * // process a result here. Result may be a DisplayObject or an Error. @@ -72,7 +73,7 @@ public class MultiLoader * MultiLoader.getContents(obj, handleComplete, true); * * - * @example + * @example Load 3 embeds, wait to handle them until they're all loaded. * * function handleComplete (results :Array) :void { * // process results here @@ -93,6 +94,24 @@ public class MultiLoader /** * Exactly like getContents() only it returns the Loader objects rather than their contents. + * + * @example Advanced usage: Loading classes. + * + * // A holder for new classes, created as a child of the system domain. + * var appDom :ApplicationDomain = new ApplicationDomain(null); + *
+ * function handleComplete (results :Object) :void { + * // now we can retrieve classes + * var clazz :Class = appDom.getDefinition("com.package.SomeClass") as Class; + * } + *
+ * // load all the classes contained in the specified sources + * MultiLoader.getLoaders([EMBED, "http://site.com/pack.swf"], handleComplete, false, appDom); + *
+ * [Embed(source="resource.swf", mimeType="application/octet-stream")] + * private static const EMBED :Class; + *
+ * * @see getContents() */ public static function getLoaders (