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!

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

Shares and Enjoy~

Did you like this post?

Subscribe here:  

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

  6. Mitch Says:

    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.

  7. admin Says:

    Hi Mitch,

    What type of weird will show up? Any print screen for me to have a look?

  8. Mitch Says:

    Thanks for the reply.
    Yes, I can send a print screen. Where to?

  9. admin Says:

    you may send to admin[at]shinedraw.com

  10. Simple Text Effect | Silverlike - A Free Microsoft Silverlight 3 Directory Says:

    [...] A very nice text switching effect shared by Shine Draw. [...]

  11. pravin Says:

    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

Leave a Reply