Link to home
Start Free TrialLog in
Avatar of smcdonald
smcdonald

asked on

ActionScript text Animation

www.Lunarmedia.com/home.html is a site that boasts that they have figured out how to use actionscript to animate long strings of text and by the looks of the site they must have.  Doing it character by character would be excruciatingly slow.  I'm relatively new to flash and don't know whether or not this is a well kept secret, but I can't find references to this "painless actionscript character animation" anywhere.  Perhaps someone knows of some tutorial links??  I have sent an e-mail to the creator of the Lunarmedia site and am hoping for a response from him as well.  So the question is, how do you animate long strings of characters using actionscript??
Avatar of SuperMario
SuperMario

That looks like a simple loop, which just modifies the _xscale, _yscale, _alpha and other properties of a text clip.

-Dan
> and don't know whether or not this is a well kept secret
I believe it is.

I've been trying to achieve this for a while!

My thoughts:
This would be very difficult to automate as character width is not consistent.
I don't believe there is a way of extracting individual characters from a text variable.

They would have a animation that changed the alpha and scale/rotation of a text variable

Otherwise it goes a litle like this.

IF not End of text file
   IF not end of line
      Position Movie Clip x points to the right of that last letter.
      Read individual character to a variable in the movie clip
   Else
      Position Movie Clip (on begining of next line)
      Read individual character to a variable in the movie clip
   EndIf
ELSE
   Stop
EndIf

This would be an action on the 2 frame of a movie clip that is looping, this way the characters would appear one by one.

To get the different effects they'd just use a different movie for the character.

IF IT'S THE LAST THING I DO... I WILL ACHIEVE THIS !!!
I know of the script and not just one but atleast two to three of them with different types of animations.
Well tell us then !

8o)
I can give you one for free and rest two can be shared for a charge.
If you want to look at one of the samples then go to my site at http://ssdesign.hypermart.net

The one that i intend to share for free will be posted on this board later in the day.
ASKER CERTIFIED SOLUTION
Avatar of ssdesign
ssdesign

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry i forgot to write the URL it's http://ssdesign.hypermart.net/text1.zip
I'd forgotten how much I hated reading other people's code.

Still... Nice effect, I like it.
Okay I don't know about smcdonald but I think it's impossible to work this out unless you give more details.

For example Variable descriptions.
string_leng
k_main
l_main
ops
m_main
alone

And some pseudo code would be useful.
If you are in this for the points then i can post some.

Oh and one more thing.... Why does the movie contain the flashplanet logo ?
hmmm ?

Oh now I see....  You got this off FlashPlanet.com... from their open source section.

Does that mean you don't know how/why it works ?

Bummer !

I gave up on that example and pretty much worked this out on my own...

I used my own pseudo code (above near top) to produce a small movie with an animated sentence... based on the 'Duplicate movie clip' function.

I found that you can read a variable 1 character at a time using:
Substring ( textline, Lnum, 1 )

Where Lnum is the position of the character in the sentence.

So with a sentence like 'hello world'
Substring ( textline, 2, 1 )
would return 'e'

Easy huh !  You just loop through the sentence incrementing Lnum.

In my original post i put:
> This would be very difficult to automate as character width is not consistent.

This is still a problem... the only way around this as far as i can see is to set some rules;

like if the character is 'l or i or j or ; or , or . '
then only move right slightly,
if it's a 'o or h or e or t etc.'
then move on slightly more and if
it's a 'W or M etc' then move on the most.

This is a pain in the arse and if any one as a better solution i'm listening !!

I will post my example with full pseudo code soon.

Rich.
LETTER WIDTH CODE:
Found this in that example... It's for working out text widths...

      If ((cr eq "i") or (cr eq "j") or (cr eq "l") or (cr eq "I") or (cr eq ".") or (cr eq",") or (cr eq ";") or (cr eq":") or (cr eq " "))
            Set Variable: "siz" = "54"
      Else If ((cr eq "f") or (cr eq "r") or (cr eq "t") or (cr eq "!"))
            Set Variable: "siz" = "61"
      Else If ((cr eq "s") or (cr eq "z") or (cr eq "?") or (cr eq "c"))
            Set Variable: "siz" = "75"
      Else If ((cr eq "B") or (cr  eq "P") or (cr  eq "R") or (cr  eq "S") )
            Set Variable: "siz" = "104"
      Else If ((cr  eq "H") or (cr  eq "C") or (cr  eq "K") or (cr  eq "V") or (cr  eq "Y"))
            Set Variable: "siz" = "115"
      Else If ((cr eq "A") or (cr  eq "D") or (cr  eq "G") or (cr  eq "N") or (cr  eq "O") or (cr  eq "Q") or (cr eq "U") or (cr  eq "X")or (cr  eq "ø")  or (cr  eq "ì")  or (cr  eq "û")  or (cr  eq "þ")  or (cr  eq "ô")  or (cr  eq "æ")  or (cr  eq "ù") )
            Set Variable: "size" = "130"
      Else If ((cr  eq "w") or (cr  eq "m")or (cr  eq "Ô")  or (cr  eq "Ö")  or (cr  eq "Æ")  or (cr  eq "Ý")  or (cr  eq "Ø")  or (cr  eq "Ì")  or (cr  eq "ß")  or (cr  eq "Ä")  or (cr  eq "Þ")  or (cr  eq "Ó")    )
            Set Variable: "size" = "150"
      Else If ((cr  eq "M") or (cr  eq "W"))
            Set Variable: "siz" = "170"
      Else
            Set Variable: "siz" = "90"
      End If
here is the result.

www.coopa.demon.co.uk/ee/funky.html

I'm pretty prowd of this !!

Rich

P.S.  Obviously this is just a test so the interface is crap.
coopa that script basically relies on the one i had posted. So do you think i should be getting some points at this stage?........ :)
You mean for the script you downloaded from FlashPlanet.com ?  You already got the points by the look of it...  

I'm not in this for the points.  I was genuinely interested in getting that effect to work.

The only bit I used was the code to space the letters correctly, the rest is my own work.

Congrats.

Rich.