I think you have to instanciate the SPADES if you do it in Actionscript
try this:
spriteHolder.addChild(new SPADES() as DisplayObject);
Alexander Farber wrote:
I've prepared an even simpler test case and it still doesn't work:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="onCreationComplete();">
<mx:Script>
<![CDATA[
[Embed('../assets/symbols.swf', symbol='spades')]
var SPADES:Class;
[Embed('../assets/symbols.swf', symbol='clubs')]
var CLUBS:Class;
[Embed('../assets/symbols.swf', symbol='diamonds')]
var DIAMONDS:Class;
[Embed('../assets/symbols.swf', symbol='hearts')]
var HEARTS:Class;
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);
// XXX everything else works, but this line reports null obj
spriteHolder.addChild(SPADES as DisplayObject);
}
]]>
</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>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders