Flash notes by Edzis

ActionScript programmer / Flash developer Edgars Simsons on professional stuff

Blur on rotationY = 0? Use transform.matrix

with 14 comments

matrix3D vs matrix in image quality

Read this article in my new blog

I have migrated my blog to www.edzis.com, please come by to read this post.

Advertisements

Written by edzis

Tuesday, 4th 2008f November, 2008 at 14:55

Posted in Adobe Air, Flash Player 10

Tagged with , ,

14 Responses

Subscribe to comments with RSS.

  1. When you say “set DisplayObject.transform.matrix”. What code do you use?

    Brian

    Tuesday, 25th 2008f November, 2008 at 18:53

  2. var myMc:DisplayObject = new Sprite();
    // be it Sprite, MovieClip, Shape or whatever extends DisplayObject
    // add content

    myMc.rotationY = 0;
    // makes the content blurry

    myMc.transform.matrix = new Matrix();
    // removes 3D transformation

    see http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/DisplayObject.html

    edzis

    Tuesday, 25th 2008f November, 2008 at 20:59

  3. Hi, i’ve came across the same problem, and your solution works. But it resets the position of the object and when i try to position it again, it becomes blured again. Even if i position it like this -> object.transform.Matrix = new Matrix(….., x, y);

    Any ideas ?

    Thanks

    Pedro Valentim

    Monday, 19th 2009f January, 2009 at 18:55

  4. Apparently any children of a displayObject who has rotationY applied also inherit the the Matrix3D object so the child also need to be reset.

    JR

    Friday, 23rd 2009f January, 2009 at 11:36

  5. Thanks, JR, for the note – didn’t think of this.

    edzis

    Friday, 23rd 2009f January, 2009 at 11:40

  6. Hey Edzis,

    I came across this problem earlier. I saw what you wrote above but still cant figure about how to apply it to an existing movieclip I have on the stage. I added your code but I dont know how to apply the displayObject to an existing movieclip. Im fairly new to AS3 so any help on this would be greatly appreciated.

    Thanks,

    David

    David

    Tuesday, 17th 2009f March, 2009 at 22:45

  7. Great fix, i solved the repositioning issue by setting a variable to the x position just before resetting the matrix, and then quickly applying that x position back on right after the reset. Probably lots of better ways of doing this but it seems to work fine.

    Heres some of my code:

    function resetMatrix(curNum:int) {
    var curMc:DisplayObject
    curMc = holder_mc.getChildByName(“child”+curNum);
    var xPos:int = curMc.x
    curMc.transform.matrix = new Matrix();
    curMc.x = xPos;
    }

    Anders

    Wednesday, 18th 2009f March, 2009 at 19:29

  8. […] de votre objet. Utilisez le code suivant : monObjet.transform.matrix = new Matrix(); Lien: Flash notes by Edzis. Flash & […]

  9. I’m having the same blurry problem when rotating Y. But this fix doesn’t really work for me cos the clip has to stay at 180 Y rotation when the tween finishes.

    Any help on this?

    Thanx

    Jimmy

    Tuesday, 9th 2009f June, 2009 at 09:31

  10. If you want to kill the blur, you have to find a way to go back to the 2D space.
    I imagine you have a Sprite with 2 children – one facing the front and another the back. If so, you could play the flipping animation and once it is done flip the children to the other sides (what was rotationY 180 now becomes 0 and vice versa) and set the container back to rotationY 0 and use set the transform matrix.

    edzis

    Tuesday, 9th 2009f June, 2009 at 09:48

  11. Hi and thanx for the answer!

    Yes exactly like that : container clip with 2 children: front and back. I’m using TweenLite for the tween and used the gotoandlearn tut code from here: http://www.gotoandlearn.com/play?id=91

    Some of my code:

    function tweenStep1():void{
    TweenLite.to(step1, 1.5, {rotationY:180, x:84, y:100, scaleX:1, scaleY:1, ease:Expo.easeOut, onComplete:tweenStep2});

    addEventListener(Event.ENTER_FRAME, loop1);

    function loop1(e:Event):void{
    if (step1.rotationY>90 && step1.rotationY= 360){
    step1.rotationY = 0;
    }
    }

    }

    Then if I add new matrix in the next func:

    function tweenStep2(){
    step1.transform.matrix = new Matrix(step1.scaleX, 0, 0, step1.scaleY, step1.x, step1.y);
    }

    the container clip step1 goes to rotationY:0

    Any further help pls?

    Jimmy

    Tuesday, 9th 2009f June, 2009 at 09:57

  12. the solution I suggested makes your step1 go to rotationY 0. But I see no code for the front and back faces.

    function tweenStep2(){
    step1.front_mc.rotationY = 180;
    step1.back_mc.rotationY = 0;
    step1.transform.matrix = new Matrix(step1.scaleX, 0, 0, step1.scaleY, step1.x, step1.y);
    }

    or for better performance you could just make the new back face invisible.

    edzis

    Tuesday, 9th 2009f June, 2009 at 10:08

  13. Ok thanx so much.

    I made the front mc invisible and rotated the back mc, and it’s close to what I’m looking after. 1 Problem thou: Now when I apply new matrix the step1 mc suddeny jumps and it looks much more uglier than the bure itself :)

    Thanx anyway!

    Jimmy

    Tuesday, 9th 2009f June, 2009 at 10:21

  14. He he :D This makes me think about what JR wrote:

    “Apparently any children of a displayObject who has rotationY applied also inherit the the Matrix3D object so the child also need to be reset.”

    So maybe you could try to loop trough the children tree of step1 and set the matrix to items in all levels.

    edzis

    Tuesday, 9th 2009f June, 2009 at 10:28


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: