reflection method in actionscript:
//refelction method
protected function getDisplayObjectInstance(skin:Object):DisplayObject{
var classDef:Object;
if(skin is Class){
return new skin() as DisplayObject;
}else if(skin is DisplayObject){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return skin as DisplayObject;
}
try{
classDef = getDefinitionByName(skin.toString());
}catch(e:Error){
try{
classDef = loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object;
}catch(e:Error){
//nothing
}
}
if(classDef == null){
return null;
}else{
return new classDef() as DisplayObject;
}
}
分享到:
相关推荐
In addition, the C++ reflection mechanism used by our library to bind to database tables allows us to add generic indexing and lookup properties to our containers with no special code required from ...
The evolution of machine civilization underscores the need for continuous reflection and cultural scrutiny in our dealings with technology. Future explorations in this field will undoubtedly involve ...
We demonstrate how a metal wire grating can work as a 45° polarization converter, a quarter-wave retarder, and a half-wave retarder over a broadband terahertz range when set up in total internal ...
A simple example that illustrates a few different ways for an application to implement support for the Android data backup and restore mechanism. Bluetooth Chat An application for two-way text ...
or changes to classes and methods caused by the addition of generics (such as the collections utilities and the reflection classes)change permeates this entire fourth edition. <br>The Java ...
Later chapters explain the package mechanism in more detail, and how to build, test, and maintain projects using the go tool. The chapters on methods and interfaces introduce Go’s unconventional ...
JDK 7 is a superset of JRE 7, and contains everything that is in JRE 7, plus tools such as the compilers and debuggers necessary for developing applets and applications. JRE 7 provides the libraries, ...
Its product version number is 6 and developer version number is 1.6.0, as described in Platform Name and Version Numbers. For information on a feature of the JDK, click on a component in the diagram ...
The critical findings associated with end-face total internal reflection (TIR) phenomemon we proved before are reported. In particular, these findings reveal that the end-face-TIR capable rays ...