gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] AVM2 Scripts


From: Benjamin Wolsey
Subject: [Gnash-dev] AVM2 Scripts
Date: Tue, 01 Dec 2009 12:52:32 +0100

Hi list,

I've committed lots of changes to trunk to move everything needed only
for AS3 into libcore/abc and to stop using those things for AS2. That
means the non-AVM2 Gnash binary is slimmer than before, as well as
allowing work on AS3 without disturbing AS2 so much.

Mostly those things were used in ClassHierarchy. This is now more or
less empty for AS2, and in AVM2 it seems it just adapts AS2 classes
(functions) for use as AS3 classes.

Unfortunately, AS3 builtin-classes are not functions, but (most likely)
'Scripts' - static representations of a Class, just like all other
SWF-defined AS3 classes. When turned into an object for use in
ActionScript, they are still not functions, but rather a Class type
(which doesn't exist in AS2).

What I think needs to be done is that:
a)      All native/builtin classes are created as Scripts. For this
        we probably need a 'built-in' type of Method (or Script) to 
        implement the ABC functionality in C++.
b)      They are constructed as Classes when used (usually via
        ConstructSuper of a SWF-defined class.

This all has to be done at once, as well as getting the Script/Class
construction order more or less correct and properly storing Script
data, or AVM2 will do nothing at all.

While a) is a very large-scale change, it ought to be possible to do it
in a few lines using function templates, provided the rest of the
infrastructure is there.

But before I attempt a change like that, some input from people who
understand AS3 would be useful.

Our Script (libcore/abc/Script.h) and Namespace classes
(libcore/abc/Namespace.h) have some new class and member function
documentation. Any checking or additions are welcome.

Script includes a 'super' member that refers to another Script. This
probably provides the answer to our ConstructSuper problems; currently
we use an as_object set as the 'prototype' of the Script (which is
completely wrong), and moreover we use it in a really wrongheaded way.
Instead we should probably fetch the Script's super Script and run its
constructor. Only that relies on the super class - possibly a builtin -
being a Script, which it currently isn't.

If I'm getting this confused or missing anything (and it is partly
guessing), please let me know.

I've also added an as_class type that inherits from as_object. This will
implement the ActionScript Class type. Currently it does nothing
different except provide an overridden stringValue(). It presumably
needs the ability to be constructed, but not called.

bwy


--
Yes, YouTube does work in Gnash (well it did until they switched to
SWF10)
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]