Objects declared on the stage are undefined when moving Flash project into FDT

StackOverflow https://stackoverflow.com/questions/10968987

  •  13-06-2021
  •  | 
  •  

質問

I have a Flash CS5 project with an FLA file and 20 to 30 class files. I am trying to move from the Adobe IDE to FDT without modifying my code too much. I have exported the SWC file from Flash and added it to my lib folder, and I can now access the symbols defined in the FLA file, but all references to objects created on the stage are coming up as undefined.

Any help or pointers to relevant tutorials would be gratefully received.

役に立ちましたか?

解決

Items placed on the stage in Flash Professional will not be accessible (even exist really) in any IDE that uses MXMLC (FDT, Flash Builder, IntelliJ....). This is because IDEs (that use MXMLC) create their own stage.

If you want to use Flash Professional so you can drag and place items onto it's stage, you'll need to create a a fake stage. Do this by creating an empty Movieclip on the stage in Flash Professional, drag and drop your times inside of this movileclip, set it to export to SWC (give it a class name such as MyStage so you know it's yours). After it's exported it as a .SWC and linked to your FDT project, create an instance of it and add it to the stage in FDT.

The items you added to this 'fake stage' are accessed as children. So you're syntax looks something like this:

    public class AnotherProject extends Sprite {
    public function AnotherProject(){
        myStage = new MyStage();
        addChild(myStage);
        myStage.item_I_dragged_insideOf.x = 100;
   }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top