Silverlight vs Flash: Resilience Rectangle Flash vs Silverlight: FPS Meter & Stress Test
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

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();

Related Post

5 Responses to “Flash vs Silverlight: Simple Text Effect”

  1. Phil’s .NET Development Blog » Blog Archive » Simple Text Effect in Silverlight Says:

    [...] 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 [...]

  2. birdwing Says:

    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.

  3. Wilbur Says:

    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

  4. admin Says:

    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();
    }

  5. Wilbur Says:

    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;
    }
    }

Leave a Reply