I have been meaning to write this post for a while now and since I have spent most of this month back in the UK visiting friends and family I don’t have all that much to share technically so I thought it was about time I got this post done.

Over the course of my 23 years of coding I have had a number of what I call “Code Epiphanies”. These are moments in my coding career where fundamental changes in how I code have taken place.
Continue reading

Just stumbled across this one while writing some mxml for a personal project and thought I would share.

Have you ever wanted to have multi-line text in your label component in spark and thought the following should work?

[codesyntax lang=”mxml”]

<s:Label text=”I like text on the n next line” />

[/codesyntax]

But all it produces is:

Yep me too.

After some playing however I stumbled accross the following solution:

[codesyntax lang=”mxml”]

<s:Label text=”I like text on the {‘n’} next line” />

[/codesyntax]

It then produces the expected result:

Im just guessing but I suspect its something to do with the black art of the flex life cycle. By adding the {‘n’} we are turning the property initialisation on the label component from a simple literal assignment into a delayed binding assignment and therefore gets parsed differently.

Just a guess, let me know if im way off.

Comment and share

Author's picture

Mike Cann

A professional games developer that just cant stop tinkering with things


Head Software Wizard at TapSlots


Perth - Australia