1 /* SVN FILE: $Id: FakeObject.as 42 2008-03-26 03:18:02Z xpointsh $ */
6 * Copyright 2008, Sean Chatman and Garrett Woodworth
8 * Licensed under The MIT License
9 * Redistributions of files must retain the above copyright notice.
12 * @copyright Copyright 2008, Sean Chatman and Garrett Woodworth
13 * @link http://code.google.com/p/fake-as3/
15 * @subpackage com.fake
17 * @version $Revision: 42 $
18 * @modifiedby $LastChangedBy: xpointsh $
19 * @lastmodified $Date: 2008-03-25 20:18:02 -0700 (Tue, 25 Mar 2008) $
20 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
27 * FakeObject is the root object for all classes
28 * in Fake. It contains a reference to the class name
29 * and class object. These are obtained by using the
30 * reflection classes in flash.utils.
32 public dynamic class FakeObject extends Proxy
35 * The name of the top level subclass
37 [Transient] public var className:String;
39 * A reference to the top level subclass
41 [Transient] public var ClassRef:Class;
43 private var __item:Array;
45 public function FakeObject()
52 * This method is called by the constructor. Populates the className and ClassRef using
53 * getQualifiedClassName and getDefinitionByName
55 private function getClassInfo():void
57 var qcName:Array = getQualifiedClassName(this).split("::");
58 className = qcName[1];
60 var classPath:String = getQualifiedClassName(this).replace( "::", "." );
61 ClassRef = getDefinitionByName(classPath) as Class;
65 * Override the callProperty of the flash_proxy
71 override flash_proxy function callProperty(method: *, ...args):*
75 return ClassRef.prototype[method].apply(method, args);
79 return overload(method, args);
84 * To be overriden by subclasses. Allows calling any method on any object that extends FakeOject
89 protected function overload(method:*, args:Array):void
94 * get a property on the object
99 override flash_proxy function getProperty(name:*):*
101 return overloadGetProperty(name);
104 protected function overloadGetProperty(name:*):*
110 * Set a property on the object
115 override flash_proxy function setProperty(name:*, value:*):void
117 overloadSetProperty(name, value)
120 protected function overloadSetProperty(name:*, value:*):void
122 __item[name] = value;
126 * Check if the property exits
131 override flash_proxy function hasProperty(name:*):Boolean