Am developing an application using action script.I want to display an image at the center of the satge programmatically..can anyone suggest how to set the possition to BitmapData?.my code is
var mysprite:Sprite = new Sprite();
var mybitmap_data:BitmapData = new atkbr_jpg(500,600) as BitmapData;
var mybitmap:Bitmap;
mybitmap=new Bitmap(mybitmap_data);
mysprite.addChild(mybitmap);
stage.addChild(mysprite);
You can center your Bitmap like that:
var mybitmap_data:atkbr_jpg = new atkbr_jpg();
var mybitmap:Bitmap = new Bitmap(mybitmap_data);
var mysprite:Sprite = new Sprite();
mysprite.addChild(mybitmap);
mysprite.x = (stage.stageWidth - mysprite.width) / 2;
mysprite.y = (stage.stageHeight - mysprite.height) / 2;
addChild(mysprite);