1
votes

I am trying to take an animation I made in flash professional, and use it inside of the Flash Builder IDE.

I have tried importing an image to the stage in flash, converting it to a movie clip and exporting it as a .swc. After adding the swc to a Flash builder project, I was able to create a class specified by the swc file, and by adding the object to the display tree I could see the image when I ran my project.

So I tried the next step which was to animate the image. I imported an image to the stage, inserted some frames and made a 1 second animation. I copied the frames, created a new movie clip and pasted the frames into the movie clip. I then exported it as a .swc.

The problem is that when I do the same thing as before (with the image), the animation is not being displayed at all. However, If I export as a .swf instead of a .swc, I can see my animation play correctly inside an instance of adobe flash player.

My AS3 code:

var testAnimation:MovieClip = new TestAnimation();
...
addchild(testAnimation);
1

1 Answers

3
votes

From Flash Pro, assure your symbol has AS Linkage:

flash-pro-symbol

You can export individual symbols from the library - Right-click on the symbol and save as SWC:

save-as-swc

Or, you can export the entire project as a SWC from Flash Pro's Publish Settings:

publish-settings

Add the exported SWC to Flash Builder's build settings. If you don't want to add individual SWC, create a libs folder and Add SWC Folder:

build-settings

Add the display object to the display list, assuring you account for registration point:

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    public class X extends Sprite
    {
        public function X()
        {
            super();

            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;

            var symbol:FlashCircle = new FlashCircle();
            symbol.x = 150;
            symbol.y = 150;
            addChild(symbol);
        }
    }
}

Build and run:

browser