[AS2] Classes returning dynamic constructs

There was a post about creating a class that could return a default value or something like this. I think Senocular was involved in the thread, and maybe Kirupa (as they were talking about creating kirupa clones and whatnot) I can’t seem to find it and I’m pretty sure it has a solution to this issue.

Basically, what I’m trying to do is have a class as a wrapper for two classes that are just distinct enough to warrant this (unless you have a way around it).

I’m compiling a course for both Flash Lite and Flash 8. Since Flash Lite has no ExternalInterface, I’m using SharedObject to store information on the device to be retrieved later. When the course runs on the web however, I want it to use ExternalInterface (not FSCommand/2!) to interact with the LMS (using SCORM.)

Instead of maintaning two different versions, I created a wrapper class to decide what interface class I use like so:


import myDevice.API_1484_11;
//import webDevice.API_1484_11;

class API extends API_1484_11 {
   public function API() {
      var SCORM = new API_1484_11();
      // I want to return API_1484_11 instead of API...
   }
}

Before I compile, I just have to uncomment one of the imports to determine what device class I’m going to use in the compile.

I thought of the thread (I think it was rather long) where Senocular and/or Kirupa were talking about creating Kirupa clones or something like that and I can’t seem to find it. Anyone have any ideas?