Flash Professional & Flash Builder Compatibility with Sprites

by Alexis Hope, 07 Feb 2012

Some notes about using sprites from Flash Professional in Flash Builder.

When adding Sprites or Movie Clips to a Flex application add them to a UIcomponent first or use rawChildren.addChild() to avoid run time errors.

<fx:Script>
 spritecanvas.addChild(new Sprite());
 // OR
 this.rawChildren.addChild(new Sprite();
</fx:Script>
<mx:UIComponent id="spritecanvas" width="100%" height="100%">

The information on labeled timelines and labeled movieclip instances remains intact

<fx:Script>
 [Embed(source="../sprites/Demo.swf", symbol="test")]
 private var TimeLineTest:Class;
 var TestTimeLine:MovieClip = new TimeLineTest() as MovieClip;
 TestTimeLine.gotoAndPlay('timelinelabel');
 // accessing sub movie clips which have been given an instance name in Flash Professional
 // TestTimeLine.inception == MovieClip
 </fx:Script>

AS3 code however does not remain intact but stop() commands do (I’m wondering if I’m missing a flag here when embedding) A movie clip symbol in Flash Professional which is given a base class of the following

package
 {
     import flash.display.MovieClip;
     public class TestClas extends MovieClip
     {
         public var TestString:String = 'Hello World!';
         public function TestClas():void {
         }
     }
 }

And then embedded into a Flex application or Flash Builder, the var TestString does not remain (nor do variables on the MovieClip’s timeline)

[Embed(source="../sprites/Demo.swf", symbol="test")]
private var TestVariablesEmbed:Class;