Fluid Morpher Class #2 – sources

January 27th, 2010
by admin

I’m willing to release some sources of my previous posts, which I forgot or just didn’t care to release ( because wasn’t thinking anybody will use it : ) )

So the first one is the fluid morpher from this post: http://blog.teleranek.org/?p=5


The Main.as file consists of 2 methods of adding the morphing effect, one of them is commented ( the commented lines makes the animation from the previous post about morpher )

First method uses Morpher class, second one uses TextMorpher class.

Simply by calling:
m.playString( "hey" , "you!" );
TweenLite.delayedCall( 8 , m.playString , [ "you!" , "blog" ] );
TweenLite.delayedCall( 16 , m.playString , [ "blog" , "reader :)" ] );

You get this effect:

Tweenlite is used just to make delayed calls to “playString” method. You could use the Timer class alternatively.

How does it work? It’s simple: I’m dividing the bitmap into smaller parts, and using “blob” technique ( technique old as world, as3 version described e.g. here: http://blog.oaxoa.com/2007/12/28/actionscript-3-blobs-lava-lamp-effect ), I’m moving them from positions where there is no transparent pixels in first bitmap, to positions without transparency in 2nd bitmap.

Posted in flash experiments | Comments (2)

2 Responses to “Fluid Morpher Class #2 – sources”

  1. mike Says:

    Hi there,

    Thanks for your class, looks good!

    I tried it but I get the following error:
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at TextMorpher/playString()
    at Main$iinit()

    Can you advise? Also that would be great if you could attach the fla too so we have access to your linked MCs for the commented part of the code.



  2. admin Says:

    Oh, I know what’s the problem.
    These classes are intented to use with Flex SDK, so you could compile it without the need of running entire flash environment, simply by calling “mxmlc Main.as -o main.swf”.
    When you want to compile it in Flash CS4, there is this line in TextMorpher.as:
    var cool:Font = new cool40();
    and cool40 was defined earlier by “Embed” flex tag, which is ignored by Flash environment. So you should define “cool40” in FLA file instead, by adding new font to library ( right click on library and “add font” ) named “cool40”.
    In the commented part of the code there are no references to linked MCs, there is only a line which says “new kroeger8()”, and this “kroeger8” is the font class, similiar to “cool40”, which you can define in library pane.

Leave a Reply