Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actionscript 3 does not support c++ style mixin class hierarchies. </p> <p>As3 rather uses the <strong>Interface</strong> approach that is utilized in many object oriented languages. </p> <p>An Interface generally is an abstract template of functionality allowing communication between objects which are unrelated in respect of class hierarchy.</p> <p>such as:</p> <pre><code>public interface IBox{ function addContentToBox(contentName:String, content:*) Boolean; function boxHasContent(contentName:String): Boolean; function getContentFromBox(contentName:String): *; } </code></pre> <p>When you define a class in as3, if you want it to implement IBox Interface you write</p> <pre><code>class YourClass extends anotherClass implements IBox { </code></pre> <p>(extends anotherClass is only needed if you are extending another class)</p> <p>Now you have to write code for functions declared in <strong>IBox</strong> in <strong>YourClass</strong>.</p> <p>Then what is the catch? Well, first of all </p> <pre><code>a = new YourClass(parameters etc); if(a is YourClass)trace('YIPPE'); if(a is IBox)trace('YAY'); </code></pre> <p>You have a trace of YIPPE YAY now. </p> <p>(xxx is IBox) will be true for all instances of all classes implementing IBox.</p> <p>You can pass any unrelated objects with classes implementing IBox to functions expecting IBox. </p> <p>Please refer to <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f41.html" rel="nofollow">Adobe as3 interface document</a> for further information.</p> <p>I hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload