0
votes

I'm brand new to AS3, trying to take a bitmap from the library and display it in the timeline with actionscript. Here's the code I'm using so far as per Adobe's site:

addChild(new Bitmap(new myBitmap(100, 100)));

and this works, but changing the dimensions in those brackets doesn't. How can I change the dimensions?

Also, how can I change the position of the bitmap? Right now it's at 0,0.

1

1 Answers

0
votes

You first get a handler of that bitmap:

var theBitmap:Bitmap=new myBitmap();

Then, you can change its coordinates:

theBitmap.x=100;
theBitmap.y=100;
addChild(theBitmap);

In order to do scaling, you can also alter its scaleX and scaleY properties as with any other displayed object. In order to make a Bitmap object to be of certain size on screen, you have to scale it so that scaling parameter equals (new dimensions)/(old dimensions). But, if you want something else, you have to explain it further.