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!
Vote for this sample
Flash is Better? (146 votes)
Silverlight is Better! (195 votes)
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, 486 hits)
Simple Text Effect [Silverlight 2, C#] (20.6 KiB, 661 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;
}
}