0
votes

[AS3] How can I transform a MovieClip to be in the exact same perspective as the image on this lunchbox?

http://snapplr.com/snap/325e

Is it possible using Matrix todo this or is there a better way?

I would love it if you could answer with an example code.

Update
I have to target Flash 9.

Update2
If it's possible using matrix, can you give me the number to get the right skew, cause I just can't get it right. I have tried distortiontweener but i can't get that one to work. Any other solutions?

4
"this lunchbox"? What lunchbox? It appears you haven't included a link to what you are referring to.Chris Pietschmann

4 Answers

4
votes

Also, if you're targeting flash player 10, you can just rotate around the x and y axis. FP10 and Flash CS4 support basic 3D built-in.

EDIT If you can't use FP10 then you'll have to look into doing it via a 3rd party library - DistortImage seems like it will do the trick just fine. It is referenced by some of the code in the links below, but this is the cleanest most simple version I can find.

ANOTHER EDIT It is not possible to to this with flash's built in Matrix class. This is because flash's Matrix only supports 3x3 matrices. You need 4x4 to do the kind of distortion you want. you need to do a proper perspective distortion, not just a skew.

0
votes

You could use Papervision and keep tweaking until you get it right.

This should come in handy.

If you don't want to use Papervision, these resources seem useful:

BitmapTransformer

DistortBitmap

HTH

0
votes

one of these should help:

http://flashenabledblog.com/menu/flash3dlist/

You probably want a lightweight one for what you are doing. That or move to fp10.

EDIT: DistortBitmap looks like the easiest, although it does not handle perspective calculation, although that is easy to do yourself.

-1
votes

There is no way to transform an object into 3D perspective using a Matrix. When Papervision3D does it they have to use multiple skews and redraw it for each one forming a new bitmapData object. If you need to target player 9, and need 3D perspective, perhaps you should look into Papervision3D, though it will add a fair bit of file size to you application.