Sha256: c6d82b133085308a7e79761edd658aaf093a0bebf0617defd706a649a95bec43
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
package com.fourD.core { import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; public class Router { private var views:Dictionary; // injected from the application... public var viewInstances:Dictionary; public function Router() { views = new Dictionary(); viewInstances = new Dictionary(); } public static function mapClasses(classes:Array, cache:Boolean = true):void { for each (var view:Class in views) { var fqn:String = getQualifiedClassName(view); var viewName:String = fqn.split("::")[1] as String; views[view] = fqn; views[fqn] = view; } // once we have set up the core data structures we need another pass to compute // the hierarchy of the components/views classes.forEach(function(elm:Class, index:int, array:Array):void { Router.extractMetadata(elm); }); } public static function extractMetadata(viewClass:Class):void { var fqn:String = views[viewClass]; var view:UIComponent = viewInstances[viewClass]; var meta:XML = describeType(view); for each (var node:XML in meta..accessor) { var declaredBy:String = node.@declaredBy; var name:String = node.@name; var child:UIComponent; // if the accessor was declared in one of your classes and it's a UIComponent... if (viewClasses[declaredBy] && view[name] is UIComponent) { child = view[name] as UIComponent; mapChildToParent(troponMap, view, child); } } } } }
Version data entries
3 entries across 3 versions & 1 rubygems