actionscript 3 - Starling: Scaling vector sprite for image crops instead of scales -


i've got vector sprites in external swf. can draw them onto starling image fine. when try scale sprite before hand, resulting image has been cropped instead of scaled.

this works fine outside of starling plain sprites, i'm new starling i'm sure i'm missing basic. appreciated. thanks!

flashdevelop + air + starling

main.as

package  {     import flash.display.sprite;     import starling.core.starling;      public class main extends sprite      {         private var starling:starling;          public function main():void          {             starling = new starling(game, stage);             starling.start();         }     } } 

game.as

package   {     import flash.display.bitmapdata;     import starling.display.image;     import starling.display.sprite;     import starling.textures.texture;      public class game extends sprite     {         [embed(source = "../assets/sprites.swf", symbol = "sprites_tiger")]         private var sprites_tiger:class;         public var tiger:flash.display.sprite = new sprites_tiger();          public function game()          {             tiger.width = 256;             tiger.height = 256;              var bitmapdata:bitmapdata = new bitmapdata(tiger.width, tiger.height);             bitmapdata.draw(tiger);              var texture:texture = texture.frombitmapdata(bitmapdata);             var image:image = new image(texture);              addchild(image);         }     } } 

edit: found work-around adding scale matrix bitmapdata.draw. still don't know why scaling converted cropping without it.

i think remember similar issue in last project , try solution:

  bitmapdata.draw(tiger, tiger.transform.matrix); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -