Sep 29
Text Effect is a very common feature for many online application. Today, I am going to introduce you a simple, but also beautiful, text effect application. It’s time to decorate your application!
Comparison
Flash implementation: 70 minutes (Implemented First)
Silverlight implementation: 80 minutes
What’s the difference?
- String to ASCII Code: charCodeAt [AS3] vs Convert.ToInt16 [C#]
Source codes
Simple Text Effect [Flash 9, AS3] (142.4 KiB, 3,362 hits)
Simple Text Effect [Silverlight 2, C#] (20.6 KiB, 5,074 hits)
Flash
Silverlight
String to ASCII Code: charCodeAt [AS3] vs Convert.ToInt16 [C#]
When you are working with text, you shouldn’t miss out the following following codes which convert a string value and ASCII code.
// AS3 var text:String = "Testing"; // Get the ASCII code for the character "T" text.charCodeAt(0) // Get the string value of the ASCII code 80 var char:String = String.fromCharCode(10);
In C#, you can achieve the same result by using the System.Convert Class.
// C# String text = "Testing"; // Get the ASCII code for the character "T" Convert.ToInt16(text.ToCharArray()[0])); // Get the string value of the ASCII code 80 String char = Convert.ToChar(80).ToString();

October 31st, 2008 at 6:54 pm
[...] searching around the internet for inspiration, I came across Shine Draw’s Simple Text Effect page. This is one of their many Flash vs Silverlight examples. I liked it and downloaded their code to [...]
November 19th, 2008 at 10:18 am
Wow.
Silverlight can’t figure out what the spacebar is, everytime the effect runs you get the “embty characer block”
where as flash knows what to do.
I wonder if this is a code issue, or a font issue.
December 9th, 2008 at 5:30 pm
Hi,
I’m not to a Flash guru, and would like to know if there is anyway to let this move load without having to click first. I found this -
private function on_added_to_stage(e : Event):void{
// place the object to the stage
_simpleTextEffect = new SimpleTextEffect();
addChild(_simpleTextEffect);
var coverClass : Class = ApplicationDomain.currentDomain.getDefinition(”Cover”) as Class;
var cover : MovieClip = new coverClass();
addChild(cover);
cover.addEventListener(MouseEvent.CLICK, on_click);
}
How can I change this to load when the page loads?
Thanks
December 11th, 2008 at 3:18 am
HI Wilbur,
it’s quite simple, you can achieve this by:
private function on_added_to_stage(e : Event):void{
_simpleTextEffect = new SimpleTextEffect();
addChild(_simpleTextEffect);
_simpleTextEffect.start();
}
December 11th, 2008 at 7:10 pm
Thanks, I figured it out *blush*. one small other thing… can i stop the loop?
// loop the text effect objects
private function expandTexts():void{
for(var i:int = 0; i < _textFields.length; i++){
var textField : TextField = _textFields[i] as TextField;
textField.scaleX += SCALE_INC;
textField.scaleY += SCALE_INC;
textField.x = - textField.textWidth/2 * textField.scaleX;
textField.y = - textField.textHeight/2 * textField.scaleX ;
textField.alpha -= ALPHA_DEC;
}
}
January 27th, 2009 at 3:12 pm
Wow, thanks for this. I digested the code and learned a lot.
However, I when I try other fonts, the spacing gets wierd - even a simple font like Times!
Have you encountered this? Any suggestions?
Thanks again.
January 28th, 2009 at 10:29 am
Hi Mitch,
What type of weird will show up? Any print screen for me to have a look?
January 29th, 2009 at 12:39 am
Thanks for the reply.
Yes, I can send a print screen. Where to?
January 29th, 2009 at 3:43 pm
you may send to admin[at]shinedraw.com
September 28th, 2009 at 6:23 am
[...] A very nice text switching effect shared by Shine Draw. [...]
January 18th, 2010 at 7:58 am
Hi Everyone…
I liked the simple text effect very much. I want to have some changes in that effect, so that it can meet my requirement, what i saw is that when first line of text appears, it appears for while and after that next line appears in same line vanishing the first one. I want that second text must appear in next line and first row should not be vanished, but must be present…pls do help me…its urgent
May 2nd, 2010 at 12:33 am
hi!, thanks for the info, this post was very utile ! avafx forex broker
July 14th, 2010 at 2:41 am
[...] Flash Silverlight Download [...]
January 28th, 2011 at 5:05 pm
This is a very exciting post, I was looking for this info. Just so you know I located your blog when I was searching for blogs like mine, so please check out my site sometime and leave me a comment to let me know what you think.
June 4th, 2011 at 7:57 pm
Very cool text effect. Been looking for something like this for the longest. I tried out your code with other fonts like Serpentine, Arial, Didot, etc, but the spacing between those fonts don’t space the same or well as with using Courier New, which you use in your code. Any reason? Any solution?
Thanks!!
September 2nd, 2011 at 12:07 am
This is awesome.. I am pretty new to silverlight. I have one question, is it possible to have a backgroud image??
September 2nd, 2011 at 12:45 am
Another Q : In silverlight, How do you avoid the ‘Click to Start’ left click button & make it load the Texts dynamically on page load. I did the below but it didn’t work for me.
public Page()
{
InitializeComponent();
_simpleTextEffect = new SimpleTextEffect();
LayoutRoot.Children.Insert(0, _simpleTextEffect);
//Insertedthis line here
_simpleTextEffect.Start();
Cover.MouseLeftButtonDown += new MouseButtonEventHandler(Cover_MouseLeftButtonDown);
}
September 2nd, 2011 at 12:55 am
Figured out. Thanks
September 2nd, 2011 at 1:38 am
Font issue that Sid specified still exist. Any suggestion would be nice. Thanks
November 21st, 2011 at 6:18 pm
I wish to express appreciation to the writer for this wonderful post.