Always Get Better

Posts Tagged ‘flex builder’

atoi in Flex/ActionScript – Converting Strings to Numbers

Saturday, February 7th, 2009

It couldn’t be easier to convert a string to a number in Flex Actionscript. The language doesn’t have (or need) an atoi() function as seen in languages like C – it’s as simple as creating a cast:

var myString:String = “15”;
var myNum:Number = Number( myString );

The framework will convert any data type, not just strings. If it is unable to do so, it will return 0 (for ints) or NaN (for floating point).

Can’t Change Country of Adobe Account

Wednesday, November 12th, 2008

Aside the from the bloated abomination that is Acrobat Reader, I can confess that I am a proponent of software from Adobe.  As a long time user of Photoshop and Illustrator, I have always found their products to be powerful and usable.

Recently I’ve taken up time creating applications with a trial version of Flex Builder.  This is the first time I have ever really given a product a full test drive during the trial – normally it gets used once or twice then forgotten about.  Flex Builder is a solid product, built on a great platform.  I can’t get enough of it.

Since I truly like this software, I decided to go ahead and plug in my credit card information to get myself a full copy.  When I got to the Adobe online store though, I was sadly let down by my experience.

I am in Canada but for some reason my existing account has ‘United States’ listed as my address.  Not a big deal, I’ll just change it, right?  No – it is not a changeable field.  You can change your region on the Adobe site but that doesn’t affect your account at all.  If I can’t change my country, I can’t order online because my credit card information will be wrong.

Not a big deal – I called the sales phone number and explained what my problem was, hoping to order the product by phone.  You can’t order software for download by phone, they will only ship it to you.  I’d much rather just have the serial number, so I am transferred to the online support department to get the country of my account changed.

Once I noticed my phone timer had reached 37 minutes, I hung up and tried searching the Internet for a solution to Adobe’s problem.  I found this blog:

Basically, you can’t change your country.  The only way to do it is to create a new account with the correct country.  It would have been nice if the gentleman in sales had known to tell me that instead of letting me wait on hold for an indefinite period of time.

Really, the reason I am most angry is because the muzak that plays on Adobe’s hold line is not just obnoxious, it’s too loud.  Right now my head is ringing and I still have no Flex Builder to play with.

Accessing the stage in Flex

Sunday, November 9th, 2008

When creating components in Flex, designers sometimes need to attach events to the main stage. Unless the application has reached creationComplete, the stage property of custom components will be null.

If you need to, for example, attach a MOUSE_MOVE event to the application stage from a component that doesn’t include a creationComplete override, you have two options.

Wait for Event.ADDED_TO_STAGE

addEventListener( Event.ADDED_TO_STAGE, function(e:Event):void
stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent );

Attach Through the System Manager Object

The system manager parents all displayable elements within the Flex application. It is an elegant way of accessing the stage through custom flex components which have not yet been added to it.

systemManager.stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent );