Announcement

Collapse
No announcement yet.

Unreal Editor caching AS2 bytecode of extended classes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unreal Editor caching AS2 bytecode of extended classes

    We are using an AS2 implementation of Scaleform 4.0 illustrated in the following diagram:



    Our menu SWF files are loaded into a shell SWF that is exposed to UnrealScript via ExternalInterface calls. A MovieClip instance on the stage of each menu SWF has a linked class that extends a base class in an external AS2 file located in the same directory.

    We are running into a problem where the base AS file appears to be cached by Unreal Editor. This means that when the menu SWF is reimported, it does not include changes to the base AS file.

    Test 1: Is Flash updating the base AS class?
    Yes. Each build of the menu SWF reflects changes made in both the menu and base AS files.

    Test 2: Is UnrealEditor updating the menu SWF file?
    Yes. If changes are made to the menu AS file, they are reflected in the UPK package.

    However, if changes are made to both the menu and base AS files, ONLY changes to the menu AS file are reflected in the build. This problem is sporadic-- changes will suddenly appear in subsequent builds unrelated to whether it the scripts have been rebuilt or packages recooked.

    Test 3: If the menu SWF extends a different class, is UnrealEditor updating the menu SWF file?

    Yes. If the filename (and constructor/references) of the base AS file are changed, the UPK package will reflect both the new menu and base AS files. However, if the base AS file's name is changed back to its original name, the reimported menu SWF will again seem to be extending an old version of the base AS file.

    This suggests that UnrealEditor is somehow caching the external AS file. Is there a setting in the INI files that will force UnrealEditor to use the newest version of all referenced class files?

    #2
    My best guess is that your workflow is not correct. Unreal has no knowledge of external AS class files. These files are compiled into SWFs in Flash. You only import SWFs into Unreal packages, not AS files.

    Comment


      #3
      I'm having the exact same issue as described above. Any edits to the base class that other classes extend are ignored, or cached, when re-importing the SWF into the UDK package. Renaming the file and importing works correctly. Another interesting thing is that changes are reflected correctly when testing from within Flash using the GFxMediaPlayer, it's only when importing into UDK that these changes are ignored. Changes to the stage are visible, so I know the file is actually being updated. But changes to the base classes are ignored. So puzzled...

      Comment


        #4
        I solved my issue, hopefully this helps in your case matanuki. Basically I had one SWF acting as a loading screen that would then in turn load another SWF. Both of these used the common base class. I was only working on and updating the 2nd SWF that was being loaded into the first. Basically, the first SWF is still using the old version of the base class internally, and since it loaded first, the 2nd SWF loaded into it would "inherit" this old version, as if its version was replaced. Basically, try re-exporting and re-importing ALL your SWF files into UDK, even if you think they aren't relevant, and see if that helps. :/

        Comment


          #5
          Originally posted by Matt Doyle View Post
          Unreal has no knowledge of external AS class files. These files are compiled into SWFs in Flash. You only import SWFs into Unreal packages, not AS files.
          External AS2 files are not compiled into the SWF files; they are turned into bytecode at runtime. To see an example of this, try running a SWF with references to an external AS2 class in the standalone Flash Player. If you close the SWF, edit the AS file, then reopen it, you will see your changes take effect.

          To follow up-- I received more direct support for this issue and was told it's probably just because we're using an old version of the UDK (August 2011). Shadiradio, what revision are you working with?

          Comment


            #6
            External AS2 files are not compiled into the SWF files; they are turned into bytecode at runtime.
            This statement is incorrect, or at least, not completely correct. All ActionScript classes are compiled into the SWF file that uses them when you hit "publish". SWFs contain byte code that the Scaleform runtime interprets using either the AS2 or AS3 Virtual Machine. If you have one SWF (SWF A) loading another SWF (SWF B) which uses an external AS class file, you should compile them in order -> SWF B, then SWF A. Then, to be safe, import/reimport both SWFs into Unreal to ensure the changes take affect.

            As I said, Unreal does not have any knowledge of external AS class files. Unreal only knows how to read SWF files - and the ActionScript that is compiled into them. Or, more correctly, the Scaleform integration knows how to handle the SWF files.

            Uncompiled ActionScript is essentially no different than uncompiled C++ - It won't do anything until it's compiled.

            Comment


              #7
              Two things to note:

              1, Every time you publish your swf you need to reimport it as the swf is an external asset that gets exported as a gfx file as it is imported into UDK.

              So MyLovelyUI.swf gets converted to MyLovelyUI.gfx during import, you can publish MyLovelyUI.swf as many times as you like and the changes will not be seen in the editor.

              2, When you say in the editor, I'm assuming you only see this with your game running?

              The reason I ask, is that if you have two swf files that have been compiled with the same class where one has been amended, the swf that loads first will load the code for that class.
              Any subsequent swf movie that uses the same class will use this.

              ie

              car.as
              --->var myColour:Number = red;
              --->sportsCar.swf
              published on monday

              car.as
              --->var myColour:Number = blue;
              edited on tuesday

              car.as
              --->saloon.swf
              published on wednesday


              sportsCar.swf and saloon.swf
              imported on thursday

              If saloon.swf is loaded first myColour will be blue for both saloon.swf and sportsCar.swf

              If sportsCar.swf is loaded first myColour will be red for both

              Comment

              Working...
              X