Flash Flip Letter Effect

September 29th, 2009 in Flash

This tutorial shows you how to create a flip letter effect. Each letter will flip 360 degrees when the user hovers it.
This tutorial uses actionscript 3 and the Flash Player 10’s 3D features.

View DemoDownload Source

1. With Flash CS4, create a new flash file (Actionscript 3.0) and save it as flipLetter.fla.

2. Rename “layer 1″ to “letters”. Select the Text tool and type your static text on the stage. Set the text properties as you like.
With the text still selected, select in the top menu Modify>Break apart to break your text into separate letters.
Convert each letter to a movie clip with registration point at the center. No need to give them instance names.
Position the letters as you like.

3. Create a new “actions” layer and open the actions panel.
We’ll use the Tweenlite engine so first go to http://blog.greensock.com/tweenliteas3/ to download it.
Extract the zip file and get the gs directory. Place this directory at the same level of your flash file.

4. In order to use the TweenLite engine write the following statement:

import gs.*;

5. Next loop through all the objects in the stage (which in our case are only our letters) in order to add to each letter a MOUSE_OVER listener that will be handled by the flip function.

for (var i:int =0; i < numChildren; i++) {
 	var mc:MovieClip = getChildAt(i) as MovieClip;
	mc.addEventListener(MouseEvent.MOUSE_OVER,flip);
}

6. In the flip function, we declare a local variable named “letter” typed as MovieClip to store which letter has processed the event.
Then we remove the MOUSE_OVER listener that we’ll re-add when the letter has finished flipping.
Use Tweenlite to create a tween on the letter’s rotationY property. To make a full rotation we remove 360 degrees. (or you can add 360 degrees, depends on which direction you’d like the letter to rotate).
When the tween has finished we re-add the MOUSE_OVER listener.

function flip(e:MouseEvent):void{
	var letter:MovieClip = e.currentTarget as MovieClip;
	letter.removeEventListener(MouseEvent.MOUSE_OVER,flip);
	TweenLite.to(letter, 1,
				 {rotationY:letter.rotationY - 360,
				 	onComplete:function(){letter.addEventListener(MouseEvent.MOUSE_OVER,flip);
				 			}
				}
	);
}

7. Here’s the final code, test your movie to see it in action.

import gs.*;

for (var i:int =0; i < numChildren; i++) {
 	var mc:MovieClip = getChildAt(i) as MovieClip;
	mc.addEventListener(MouseEvent.MOUSE_OVER,flip);
}

function flip(e:MouseEvent):void{
	var letter:MovieClip = e.currentTarget as MovieClip;
	letter.removeEventListener(MouseEvent.MOUSE_OVER,flip);
	TweenLite.to(letter, 1,
				 {rotationY:letter.rotationY - 360,
				 	onComplete:function(){letter.addEventListener(MouseEvent.MOUSE_OVER,flip);
				 			}
				}
	);
}
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Twitter


What you think ...

(18 Comments)

+ Add a Comment
  1. Keny
    Sep 30th, 2009

    Great effect, very useful
    Thanks very much

  2. Muzik Dinle
    Sep 30th, 2009

    Thanksss very much ;)

  3. tirath
    Oct 1st, 2009

    Awesome effect
    Thanks so much for posting & sharing it
    Keep up good work
    God bless you :-)

  4. thata
    Oct 2nd, 2009

    it’s great

  5. Kirsten
    Oct 4th, 2009

    Really cool
    Thank you for all the tuts

  6. Adobe Flash: 35+ Animated Trainings | oOrch Blog
    Oct 5th, 2009

    [...] Flash Flip Letter Effect [...]

  7. Raju Singh
    Oct 9th, 2009

    Thank you for all tutorial which is here .

  8. parul
    Oct 26th, 2009

    is the great effect

  9. Tyler
    Nov 6th, 2009

    please will lay out this lesson with pictures!

  10. Bad
    Nov 27th, 2009

    I have a problem with line 11 (TweenLite.to(letter, 1,), it says: undefined property…
    Can you help me please?

  11. ranacseruet
    Jan 3rd, 2010

    Nice tutorial. But does rotationX and rotationY is supported in flash cs3?

  12. Ditch
    Jan 23rd, 2010

    Ok it must be great to see… But the tuto is not really well done… You should put some picture with what we have to do and WHERE… Thx !

  13. yoc
    Jan 25th, 2010

    Does it work with CS3 ?!
    In my case, it’s not working but there isn’t errors…

  14. Projektowanie
    Feb 5th, 2010

    ok guys, how to make the letters to link sth? PLZ help!

  15. wintes
    Feb 26th, 2010

    Nice tutorial. Great effect.
    Thanks very much

  16. learning
    Mar 8th, 2010

    i got no error msg but its not flipping =\
    im using flash CS4..
    and what is gs by the way?
    is it “greensock-as3″??

  17. flashfan
    Mar 10th, 2010

    if u could pleas upload screenshots would be more easier to understand

  18. flashfan
    Mar 10th, 2010

    i am not able to convert each letter to movieclip
    and one it was successful but all the letter were rotating at the same time i mean the whole word get filpped

Leave a Comment

Name (required)

E-mail (required, will not be published)

Website