getbounds problem with tweenlite
I have a bitmapData that I want to scale with TweenLite but when applying the transformaroundcenter plugin I get this error message:
"Property getBounds开发者_运维问答 not found on flash.display.BitmapData and there is no default value."
Where do I have to place the "activate" line (e.g. into the constructor, other functions, etc.)?
Can anyone help, please? Thanks.
import com.greensock.*;
import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.TransformAroundCenterPlugin;
TweenPlugin.activate([TransformAroundCenterPlugin]);
TweenLite.to(tempScore.bitmapData, 2, {transformAroundCenter: {scale:2}});
Judging by the exception, it looks like the library/plugin is expecting a DisplayObject
, which BitmapData
is not. Try creating a Bitmap
to pass instead. A Bitmap
is a DisplayObject
that represents BitmapData
.
var bitmap:Bitmap = new Bitmap(tempScore.bitmapData);
TweenLite.to(bitmap, 2, {transformAroundCenter: {scale:2}});
BitmapData inherits from Object, Bitmap inherits from DisplayObject. Either create a new Bitmap instance from your BitmapData as Peter suggests, or try applying the TweenLite transform to your tempScore object, assuming tempScore is a DisplayObject.
精彩评论