Hello,

may I ask another Flex question here?

(the Yahoo flexcoders-list seems not to be very responsive,
asked a question 4h ago there, it still hasn't appeared)

I've prepared a short test case to demonstrate my problem:

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,...)

I've tried many things, like casting to MovieAsset, Sprite, Image...

Thank you
Alex
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to