Solved

Convert Bitmap to MoviClip

Posted on 2009-05-15
3
289 Views
Last Modified: 2013-11-11
I have the following code to create a new BitmapData. How could I convert this bitmap to a new MovieClip or Sprite?

var myMatrix:Matrix = new Matrix();
myMatrix.tx=55;
myMatrix.ty=55;
var myBitmapData:BitmapData=new BitmapData(400,400,false,0x009966);
var bm:Bitmap=new Bitmap(myBitmapData);
myBitmapData.draw(b_mc, myMatrix);
AddChild(bm);

0
Comment
Question by:TonoNam
  • 2
3 Comments
 
LVL 12

Expert Comment

by:alien109
ID: 24399660
There's no way to cast a BitmapData object to a Sprite or Movieclip datatype. However, you can add it to the sprite/movie clip's display list (make it a child of it).

To add it to a new Sprite or MovieClip
mySprite = new Sprite();
mySprite.addChild(bm);

But you probably already knew how to do that. :)
0
 

Author Comment

by:TonoNam
ID: 24399817
For some reason when I add bm to a movieClip of Sprite it does not work. I can just add bm to the main stage by writing:  addChild(bm)    but whenever I try to stuff like  myMovieClip.addChild(bm) there is an error. Is it iposible to add a bitmap to a MovieClip?
0
 
LVL 12

Accepted Solution

by:
alien109 earned 125 total points
ID: 24411532
What kind of error are you getting? The following code is valid, and shouldn't produce any errors - demonstrating you can add a bitmap object to both a sprite and a movieclip.

var bm1:Bitmap=new Bitmap();
var bm2:Bitmap=new Bitmap();

var sprite:Sprite = new Sprite();
var movieclip:MovieClip = new MovieClip();

sprite.addChild(bm1);
movieclip.addChild(bm2);
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SWF capture the time on the Video 3 225
Cannot install Adove Flash player on Windows 2012R2 6 103
Shockwave Flash Object within PowerPoint 2013 2 151
File conversion question 5 118
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question