topical media & game development

talk show tell print

lib-flex-animation-code-10-org-as3lib-utils-strictIs.ax

lib-flex-animation-code-10-org-as3lib-utils-strictIs.ax (swf ) [ flash ] flex


  package org.as3lib.utils
  {
          import flash.utils.*;
          
          
Checks the class of <code>instance</code> against the <code>compareClass</code> for strict equality. If the classes are exactly the same, returns true. If the classes are different even if the <code>instance</code>'s class is a subclass of <code>compareClass</code>, it returns false. Does not work with interfaces. The compareClass must be a class.
author: Mims Wright @example <listing version="3.0"> var myBase:BaseClass = new BaseClass(); var mySub:SubClass = new SubClass(); trace(@ax-lib-flex-animation-code-10-org-as3lib-utils-strictIs(myBase, BaseClass)); // true trace(@ax-lib-flex-animation-code-10-org-as3lib-utils-strictIs(mySub, SubClass)); // true trace(@ax-lib-flex-animation-code-10-org-as3lib-utils-strictIs(mySub, BaseClass)); // false </listing>
parameter: instance - the object whos class you want to check.
parameter: compareClass - the class to compare your object against.
returns: true if instance is strictly of type compareClass.

  
          public function @ax-lib-flex-animation-code-10-org-as3lib-utils-strictIs(instance:Object, compareClass:Class):Boolean {
                  var instanceClass:Class = Class(getDefinitionByName(getQualifiedClassName(instance)));
                  return instanceClass == compareClass;
          }
  }


(C) Æliens 19/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.