_level0 is the main timeline in the as2 swf (unless the as2 swf is loaded into an as3 swf).
in any case, are you trying to convert the as2 to as3, or are you loading an as2 swf into an as3 swf or something else?
Hi kglad! Really "glad" to see you replied
I will try to be as specific as possible. The flash controls that I will develop are going to send commands and read parameters from a piece of embedded software on a PC. The company that sold us this interface, which is packaged as an .exe, sort of does not 'write' software primarily so their interface uses some old technology, namely AS2 and Windows DDE. So in order to get the binding to happen correctly I have to create my class with specific set and get methods and extend their class which is an extension of mx.core.UIObject (since it is AS2 code). I understand enough about AS2 to know the only reason I can't rewrite their class in AS3 is because of the way they are fiddling around with the _root to obtain an object reference to the level0 movieclip at runtime. The key line in their class is something in their class constructor like this: (not exact, I don't have it open at the moment, will edit later).
_root.components = _root.components + getInstanceAtDepth(_root.getDepth());
So this is creating a parameter called .components in the _root object at runtime that acts as a 'pointer' to the root. When I put a trace statement "trace(_root.components);" it returns _level0.classname which as you stated is a instance of the class running at the main timeline. I can get the same output putting "trace(this);" in the root timeline it returns _level0.classname
I think it will work that I can add code to the main timeline but AS3 complains about having 'classes' running in the main timeline. I can create simple shapes on the stage then export them for actionscript, but even then I think the 'root' here is the stage.
Anyway it sounds like something that should have a fix, I doubt that I am the first one to have this problem
1 person found this helpful
i don't see how you can extend an as2 class with an as3 class.
and i don't understand how you're doing anything with with an exe, other than execute it.
The executable is able to interact with the SWF. I don't know exactly how either other than they said it uses DDE.
It sounds like I am stuck writing in AS2.
I suppose now I have a follow-on question about how to use the Flash Pro components library in an AS2 project. The last version of this which contained AS2 components was CS4, all subsequent versions the code snippets and components library are AS3 code and can not be used in an AS2 project. So do I have to go find a copy of CS4 out there somewhere or is it possible to download the AS2 components?
I know this is a separate question and may have to become a separate thread. Thanks.