views:

2166

answers:

4

I'm looking for a solution to skew images. Flash only allows skewing of vector-based objects. I tried to use matrices but could not get a propriate solution. The goal is to do something like a threefold-brochure which folds out in two steps.

Does someone have a hint or example code for this?


UPDATE!

Maybe my message was a little bit wrong verbalised. Flash allows to skew, for example, a rectangle to a rhomboid.

 -------         -------
|       |        \      \
|       |   =>    \      \
|       |          \      \
 -------            -------

That's not the restriction i meant. I'm able to do WYSIWYG skewing like this for vectors and bitmaps. I need to do something like this:

 -------         |`
|       |        |  `|
|       |   =>   |   |
|       |        |  ´
 -------         |´

Based on Bryan Grezeszak answer, i played with transformation movieclips on the linked page. Am i right when i say that there is no possibility to do this with matrices? If yes, are there other possibilities to achieve this?

Thanks =)

A: 

You can skew any movieclip on the timeline of the Flash IDE, even one containing bitmap images, but there is no skew property. For something more dynamic you can create a movieclip with 200(e.g.) frames of animation going from one extreme of skew to the other, then dynamically add content to this movieclip. Hacky, but it will work. If you can get to grips with the math you can use matrix transformations in Flash Player 10 to achieve the effect.

Iain
Not possible with code? Matrix my dear boy, matrix. ALL on screen tranformations can be done via an object's transformation matrix.
Bryan Grezeszak
I did know that - I meant there is no SKEW property - and was just suggesting a quick solution as he said he was having trouble with the maths
Iain
+3  A: 

EDIT BASED ON YOUR UPDATE: The transformation you specified that you want is exactly what is accomplished with Matrix3D in flash 10. They changed it from a 3x3 matrix to a 4x4 matrix to allow the skewing you are trying to do. If you are using flash 10, Matrix3D is your answer. If not, try out AS3 3D engines such as Papervision or Away3D.

If you are using Flash 10, then look up it's Matrix3D object (ONLY in Flash 10), because it allows even more skewing of the object, actual 3D perspective, etc, prolly exactly what you are looking for :)

Other than that the object's transformation matrix is what does it. It is a flash.geom.Matrix object that can be accessed on any DisplayObject (including Bitmaps) using your_object.transform.matrix;

It can be tricky to get used to, but this is the most comprehensive source I know of for dealing with it: Senocular Matrix Article

That article is for Flash 8, but the functionality has changed almost none into AS3, so it is still a valuable resource.

Bryan Grezeszak
thanks, will try that.
pduersteler
clarified my meaning. Seems like i can't do this with matrices.
pduersteler
Think you judged my answer too quickly there old boy!
Iain
Upvoted anyway for nice detailed answer,
Iain
No, I didn't, every in on stage transformation can be done in script. You said that skewing "can simply not be done in script". The "is not skew property" you now changed it to is also false. transform.matrix's .b and .c property's change the skew. And Flash 10 gives you even more control, including 3D skewing.
Bryan Grezeszak
A: 

pity the year doesnt appear on the date... hope it 2009

an answer is here http://evolve.reintroducing.com/2007/11/18/as3/as3-distortiontweener/

;-) nobull

A: 

fp9 solution: http://www.rubenswieringa.com/blog/distortimage

starpause