I'd like to share the solution for my problem for the archives:

TestCase.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
        layout="absolute"
    creationComplete="onCreationComplete();">
    <mx:Script>
       <![CDATA[
         private function onCreationComplete():void {
                                var sprite:Sprite = new Sprite();
                                var g:Graphics = sprite.graphics;
                                
                                g.beginFill(0x0000FF);
                                g.drawCircle(100, 100, 10);
                                g.endFill();
                spriteHolder.addChild(sprite);

                                var suit:String = "SPADES";
                                var sprite2:Sprite = new (Symbols[suit] as 
Class);
                sprite2.x = 50;
                sprite2.y = 50;
                sprite2.rotation = 50;
                spriteHolder.addChild(sprite2);
           }
       ]]>
    </mx:Script>
        <mx:VBox width="100%">
        <!--
            <mx:Button label="1" icon="{SPADES}" />
            <mx:Button label="2" icon="{CLUBS}" />
            <mx:Button label="3" icon="{DIAMONDS}" />
            <mx:Button label="4" icon="{HEARTS}" />
            -->
                <mx:UIComponent id="spriteHolder" width="200" height="200"/>    
    
        </mx:VBox>      
</mx:Application>


Symbols.as:

package {
    public class Symbols {
        [Embed('../assets/symbols.swf', symbol='spades')]
        public static const SPADES:Class;

        [Embed('../assets/symbols.swf', symbol='clubs')]
        public static const CLUBS:Class;

        [Embed('../assets/symbols.swf', symbol='diamonds')]
        public static const DIAMONDS:Class;

        [Embed('../assets/symbols.swf', symbol='hearts')]
        public static const HEARTS:Class;
    }
}


Reply via email to