Remove Focus From a Text Input In Flex
If you want to remove the focus from a flex component you can use this:
this.stage.focus = null;
Singletons… Learning the hard way
This post will be about the singletons, when you should use them and when not. I decided to write this post because I made a mistake on a project that I was working on using this design pattern and I had to spend half of day to fix it.
So if you don't know what a singleton is them a simple explication would be: a class that has no more then one instance witch you can use in the entire project. For a more detailed explication you can find out on wikipedia. We could even compere a singleton class to a global variable.
Why you would want to use it?
It's main advantage is that you can access and modify it from any place of your application: class methods, static methods, functions etc. Most of my singletons classes would have the role to store different properties for my application, lets say like the user that has logged on. You create a class based on this design patter, add the public property loggedUser and when the user logs in then that property is modified. You don't have to bother with passing the user variable from class to class, or component to component, if you want to use it just call the static getInstance method of the singleton class and read the loggedUser property. That's all. You can store many other information in this class like application status, general settings.
When not to use it!
You created an application using one, or two singletons and everything looks ok and works perfectly. Then someone ask you to integrate you application in a bigger one and would like to have more then one instance of you application running inside it. From the moment that a new instance of you application/component is created your app is finished. Because you used singleton classes, the classes from the second or third instance will direct to the first singleton class.
This is it's main flaw. You can not have more then one instance. Sometimes it works for you sometimes it don't. But the main purpose of object oriented programming is to have objects related with other: parents, children - inheritance, siblings - more then one instance etc. If you create a component that can be uses in only one way than you remove all the flexibility and adaptivity from it the it's life time will be a very short one.
Be very careful when you choose this design pattern. You must think ahead and realize if you want your application to be a stand alone app or just a component from a bigger one. Choose wisely
Great day for Flex/Flash Developers
Today at Max 2009 Adobe announced the ability to build iPhone application with action script 3. Multitouch api and other were added to flash so developers could take advantage of the iPhone features. By the end of this year Adobe promised to release the tools required and personally I can't wait to create my first flash iPhone app.
You can find more information on the adobe labs.
Graduated

European Engineer
On 16 July 2009 I graduated from the Automatics and Computer Science at the University of Polytechnic of Bucharest. Hoorrayy
New hosting, new domain and new ideas
I moved all my projects and websites on a new server so that I can manage them better. I will redirect the razvan-surdu.com to this IP address and configure all settings a.s.a.p.