All Posts in Flex
Over the last couple of days I've been playing with the Rich Text Editor component in Flex, however when trying to use embedded fonts the editor seemed to switch to a default font. It appears that if you want to want to use custom/ embedded fonts in your project you also need to include the default Flex font (Verdana) in your styles declaration.
The reasoning is that if Flex tries to use a font that is not embedded, it will automatically switch to the use of system fonts. By default the Rich Text Editor uses Verdana, so in turn if you don't embed or locate Verdana, Flex will ignore your embedded fonts and switch to default system fonts, now for the code...
U+0020-U+0040, /* Punctuation, Numbers */
U+0041-U+005A, /* Upper-Case A-Z */
U+005B-U+0060, /* Punctuation and Symbols */
U+0061-U+007A, /* Lower-Case a-z */
U+007B-U+007E; /* Punctuation and Symbols */
Over the last couple of days I've had some time to look into a few features of Flash Builder, one of the exciting ones being the inclusion of unit testing. After having a quick look at online examples I was running into a few issues finding a complete example using Flex Unit 4 within Flash Builder, so here is a quick overview to get you up and running based on a mixture of examples I have been playing with.
We start by building a new flex project, >File >New >Flex Project. For this example I will just name it
UnitTestDemo, keep the other settings as default (i.e. Application type: web, SDK:Flex 4), hit Finish. Now lets create a class we will perform our tests on. Here is my example class, named
public class TestObject
public function TestObject()
public function returnNumberOne():int
public function returnString(value:String):String
public function returnTrue():Boolean
This is just a simple class with a few example functions which we will run our tests on, ok... now for our test class. >File >New >Test Case Class. Create a name for your class, in this case I have named it as
TestClass, Flash Builder will create folder to place these into named flexUnitTests.
Lets start with the more simple side of things where users simply want to share a simple link.
Add to Any
Those are just some of the basics. For a slightly different scenario, how about we have created a project where the user wishes to share a custom status alongside an image for example. You will see examples of this in your "News Feed" of your Facebook Account where friends may have shared games scores which also contain a link to the game and a small thumbnail image to promote the game or application.
As many of us know, memory management in any good size project is a topic that particular attention must be paid to. Over the last 12 months I have seen myself carrying out more and more research into memory management, in a recent project for example I was able to bring the memory usage of a website down by almost 30% in a matter of minutes by integrating simple techniques that I adopt in my own project builds.
In the words of Grant Skinner, "With great power comes great responsibility", and as we find ourselves building more complex applications it is important we consider the internal Garbage Collector and help it carry out its chores. The understanding of the Garbage Collector is another topic in itself, this post is merely a few pointers which I use as a rule of thumb in my work flow.
- Add an Event.REMOVED_FROM_STAGE listener to instance which calls in built function to tidy up assets for garbage collector
- Use weak event listeners
- Remove/ set to null any variables passed into the instance/ container
- Set to null any strings contained by components e.g. label.text = null / image.src = null
- Remove all children of the instance
- Delete the instance i.e. delete this
- Grant Skinner - Understanding garbage collection in Flash Player 9