Hello,

I'm new to this list and also Flex.

I'm stuck with a probably simple problem, which 
I'd like to demonstrate with a short test case:

Test.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.lineStyle(1, 0xFF0000);
               g.beginFill(0xFF0000);
               g.drawCircle(100, 100, 20);
               g.endFill();

               spriteHolder.addChild(sprite);

               // XXX stuff below not working
               var suit:String = 'SPADES';
               var mc:MovieClip = new (getDefinitionByName("Symbols.CLUBS") as 
Class);
               spriteHolder.addChild(mc);
          }
      ]]>
   </mx:Script>
       <mx:VBox width="100%">
           <mx:Button label="1" icon="{Symbols.SPADES}" />
           <mx:Button label="2" icon="{Symbols.CLUBS}" />
           <mx:Button label="3" icon="{Symbols.DIAMONDS}" />
           <mx:Button label="4" icon="{Symbols.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;
   }
}

How could I make the mc appear? Everything else work ok.
(the icons appear at the buttons, there is a red circle,...)

Thank you
Alex



Reply via email to