Skip to main content
AttaBoy2
Inspiring
May 25, 2009
Answered

how do I convert a jpg to a Sprite

  • May 25, 2009
  • 1 reply
  • 3948 views

Just want to turn a jpg into a Sprite dynamically.

This topic has been closed for replies.
Correct answer Craig Grummitt

When you load an external jpg, your Loader.content is of type flash.display.Bitmap. I don't believe you can convert this Bitmap to a Sprite.

Why do you need it to be a Sprite? Bitmap is a display object.

If you definitely need a Sprite, all i can think of is to create a Sprite and add the Bitmap to your sprite using Sprite.addChild.

1 reply

X-Slider
Known Participant
May 25, 2009

I attached a flash CS3 file has your answer , it is as an example, maybe it helps

http://www.4shared.com/file/107770641/befaef55/answer.html

AttaBoy2
AttaBoy2Author
Inspiring
May 26, 2009

Your example takes an existing MC in the library and puts it on the stage.  I'm trying to find a way to load a jpg from a folder and convert to a Sprite.

Craig Grummitt
Craig GrummittCorrect answer
Inspiring
May 26, 2009

When you load an external jpg, your Loader.content is of type flash.display.Bitmap. I don't believe you can convert this Bitmap to a Sprite.

Why do you need it to be a Sprite? Bitmap is a display object.

If you definitely need a Sprite, all i can think of is to create a Sprite and add the Bitmap to your sprite using Sprite.addChild.