Hi guys,

OK, burak has sent me a fix.

For those interested - the issue is this.

ASV exports the classes in 2 different forms - one on frame 0, just
for definition, with an initclip, and then again on frame 1, with an
initclip and an Object.registerClass statement. For example:

Frame 0:
#initclip
    if (!_global.libAS2) {
        _global.libAS2 = new Object ();
    }
    if (!_global.libAS2.controls) {
        _global.libAS2.controls = new Object ();
    }
    if (!_global.libAS2.controls.VScrollBar) {
................................code continues on...............................


Frame 1:
    #initclip 2
    Object.registerClass("scrollBar", libAS2.controls.VScrollBar);
    if (!_global.libAS2) {
        _global.libAS2 = new Object ();
    }
    if (!_global.libAS2.controls) {
        _global.libAS2.controls = new Object ();
    }
    if (!_global.libAS2.controls.VScrollBar) {
................................code continues on...............................


In order to get it to work in a movieclip which is designed to have
the class attached via linkage, paste the Frame 0 version of the class
(or #include it) into the first frame of the movieclip, and add the
second line from the frame 1 version, in our case:

    Object.registerClass("scrollBar", libAS2.controls.VScrollBar);

at the end of the class, just before the #endinitclip. Then they seem
to work identically to the AS2 versions.

This is a great find, because it means we can now write components &
classes in AS2, and easily, reliably port them to AS1 with virtually
no human effort.

Thanks Burak!

Alias

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to