开发者

getbounds problem with tweenlite

开发者 https://www.devze.com 2023-03-20 08:27 出处:网络
I have a bitmapData that I want to scale with TweenLite but when applying the transformaroundcenter plugin I get this error message:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消