Flash Professional & Flash Builder Compatibility with Sprites

Posted by Alexis Hope on 7 February 2012 | 0 Comments

Tags: ,

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

1 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%">

2. 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>

3. 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;

var TestVars:MovieClip = new TestVariablesEmbed() as MovieClip;
trace(TestVars.TestString) // results in access of undefined variable

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments