0 Replies Latest reply on Jul 3, 2012 10:05 AM by efosGD

    Loading SWFs: Classes do not match

    efosGD

      I've written an AIR app which loads coompiled SWFs and manipulates them.  The problem I've run into is that I cannot access the custom objects in the SWF because their class definition does not match the class definition in the AIR app.

       

      I have a library project that I develop all the classes in.

       

      The SWFs are published from Flash using the Source Path of this library, and the AIR app has the library project listed in its Build Path Libraries in FB 4.5.

       

      Example:  vManager is a ViewManager, a custom class used in the SWF to do various things.  It is accessible to the AIR runtime, but the AIR runtime thinks it's some other class that doesn't exist anymore:

       

       

       

      From the AIR runtime:

      trace(describeType(contentMC.vManager).toXMLString());

       

      <type name="gdit.controls::ViewManager" base="Object" isDynamic="false" isFinal="false" isStatic="false">

        <extendsClass type="Object"/>

        <constructor>

          <parameter index="1" type="flash.display::DisplayObjectContainer" optional="false"/>

        </constructor>

        <accessor name="state" access="writeonly" type="gdit.controls::ViewStateButton" declaredBy="gdit.controls::ViewManager"/>

        <accessor name="directiveText" access="writeonly" type="gdit.controls::IndexedTextField" declaredBy="gdit.controls::ViewManager"/>

        <accessor name="states" access="readonly" type="__AS3__.vec::Vector.&lt;gdit.controls::ViewStateButton>" declaredBy="gdit.controls::ViewManager"/>

        <method name="addViewState" declaredBy="gdit.controls::ViewManager" returnType="void">

          <parameter index="1" type="flash.display::Sprite" optional="false"/>

          <parameter index="2" type="Array" optional="false"/>

        </method>

        <method name="setDefaultViewState" declaredBy="gdit.controls::ViewManager" returnType="void">

          <parameter index="1" type="Array" optional="false"/>

        </method>

      </type>

       

      From the SWF:

      trace(describeType(vManager).toXMLString());

      <type name="gdit.controls::ViewManager" base="Object" isDynamic="false" isFinal="false" isStatic="false">

        <extendsClass type="Object"/>

        <constructor>

          <parameter index="1" type="flash.display::DisplayObjectContainer" optional="false"/>

        </constructor>

        <variable name="defState" type="String">

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="527"/>

          </metadata>

        </variable>

        <accessor name="state" access="readwrite" type="gdit.controls::ViewStateButton" declaredBy="gdit.controls::ViewManager">

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="2302"/>

          </metadata>

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="2378"/>

          </metadata>

        </accessor>

        <accessor name="defaultState" access="readonly" type="__AS3__.vec::Vector.&lt;flash.display::DisplayObject>" declaredBy="gdit.controls::ViewManager">

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="577"/>

          </metadata>

        </accessor>

        <accessor name="states" access="readonly" type="__AS3__.vec::Vector.&lt;gdit.controls::ViewStateButton>" declaredBy="gdit.controls::ViewManager">

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="694"/>

          </metadata>

        </accessor>

        <accessor name="directiveText" access="writeonly" type="gdit.controls::IndexedTextField" declaredBy="gdit.controls::ViewManager">

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="3075"/>

          </metadata>

        </accessor>

        <method name="addViewState" declaredBy="gdit.controls::ViewManager" returnType="void">

          <parameter index="1" type="flash.display::Sprite" optional="false"/>

          <parameter index="2" type="Array" optional="false"/>

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="1220"/>

          </metadata>

        </method>

        <method name="setDefaultViewState" declaredBy="gdit.controls::ViewManager" returnType="void">

          <parameter index="1" type="Array" optional="false"/>

          <metadata name="__go_to_definition_help">

            <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

            <arg key="pos" value="1577"/>

          </metadata>

        </method>

        <metadata name="__go_to_ctor_definition_help">

          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

          <arg key="pos" value="793"/>

        </metadata>

        <metadata name="__go_to_definition_help">

          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>

          <arg key="pos" value="193"/>

        </metadata>

      </type>

       

       

      Both of these statements trace in  the AIR runtime.  Note that the SWF class is much larger:  this is because the AIR version is referencing a class definition that is roughly 4 versions old.

       

      I've tried wiping out the class def after publishing the SWF, and the AIR app still refers neither the current version of the class in the Library project, nor the version compiled in the SWF. 

       

      There are no errors or warnings in the Lib project, the main AIR project, or the SWF.  I've tried cleaning both projects, referencing the SWC directly, nothing seems to correct this issue.

       

      Maybe I'm integrating the library project incorrectly in FB?  I don't know, but if anyone does:  please let me know!

       

      Thanks