Embedding bitmaps doesn't usually produce a Sprite, it usually produces a SkinBitmap, which extends BitmapData. So, you can't do that coersion.
(The "usually" qualification is because if you apply Scale-9 to your bitmap, you do get a Sprite-derived subclass.) -rg > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of quasimotoca > Sent: Friday, February 10, 2006 8:22 PM > To: [email protected] > Subject: [flexcoders] Using Embed not working in Beta (worked > in Alpha) > > Hi: > I used to do this in Flex alpha: > > [Embed(source="images/mypicture.png")] > private var MyPicture:Class; > ..... > public function MySprite() > { > var c:UIComponent > var s:Sprite > > MyButton = new UIComponent() > MyButton.visible = false > s = Sprite(new MyPicture()) > MyButton.addChild(s) > ..... > } > > In the beta I get the following error: > > TypeError: Error #1034: Type Coercion failed: cannot convert > [EMAIL PROTECTED] to flash.display.Sprite > at ..... [lots of stuff] > > Anyone else having similar trouble? Any solutions greatly welcome! > Cheers, > Dave > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

