In the previous post we began building our custom Spark colorPicker by creating the preview class and it's corresponding default skin.
In this post we will begin by creating a KeyboardManager class that will allow us to calculate the new index in the dataProvider after a Up/Down/Left/Right keyboard input.
This class can become quite complicated because we want the following behaviour from our keyboard manager.
The selected index should be able to move up past the top of the dataProvider and move to the bottom row and vice versa, in addition we should be able to go off the left hand side of the columns and appear on the right hand side and vice versa.
For example if the dataProvider has 25 items and each row contains 5 columns.
Up / Down Examples.
If we are at column 1 row 1 ( box 1 ) and we press up we should go to column 1 row 5( box 2 ) and then for every key press we should move up the column until we hit the row 1 column 1 index again. However if we press down then we should go to column 1 row 2 and so forth until we hit column 1 row 5 ( box 2 ). Then when we press down again we should move to the top of the column again row 1 column 1 ( box 1 ) and this should be the case for each column no matter how many rows it has.
Box 1 Box 2
I recently discovered that you can create custom components that can appear under your own company/personal folder inside Flash/Flexbuilder design view. Normally any custom component you create will appear under the Custom folder in the Components View and well thats not very good for branding now is it. In addition you also get an actual size representation of your component in Design view rather than just an empty box outline. For example the first image is the default and the second the custom.
For the last six months I have been working on a rather large enterprise application that uses parsley as it's main Dependency Injection Framework. This has led to many complex class' that contain multiple injected models, VO and other elements. Recreating these items inside test harness can become very cumbersome if you have to create a large injection heirarchy. Consider the following example.
I have been looking into bits, bytes and bit shifting a lot recently so I thought I would quickly make a small binary clock to help burn it into my mind. In addition it also gave me the chance to experiment with the spark skinning. Below is the result. Not pretty I know but thats what the skinning is for.
I have been using Flex for a couple of years now and i still find new and interesting framework items. In comes IMXMLObject. Up until recently whenever i wanted to place a non visual component into mxml i was extending UIComponent to allow me to place these items in MXML, however among other things this meant that they would be included in the layout and come with a high footprint.
The solution seems to be to implement the IMXMLObject interface this will allow you to place non visual components into your mxml code without having to worry about layout or an unnecessary memory footprint.
I just wanted everyone to know about this awesome class i found. I needed to load some Flash 8 movies into my flex application and control the play head dependent on labels inside the flash movie.
This was proving really hard until i found that class now it is a piece of cake!
Thanks whoever you are maruthi2000
Flex Cookbook Recipe 5.8 Allow Certain items in a list to be selectable, Doesn’t quite work correctly
Ok I needed to disable Heading elements inside a List Component in Flex, and i was being too lazy to work it out for myself so i picked up the Flex cookbook Adobe had been kind enough to send me and yes... It was there. Now the Mouse removal was straight forward and worked like a charm. But the keyboard events were a different story. The code didn't work for several reasons.
1. Key directions were not being assigned.
2. When a disabled item was at either the top or the bottom of the list it would stop you being able to continue down / up the list.
To fix this i added the following code.
Ok I have been working with the salesforce API for a couple of days now and I have found it very interesting. However I have found a few things that don't seem to be very clear when trying to simply login to your account from an application that is running outside of the salesforce Sandbox.
So as i have seen a lot of posts about this i have decided to explain how i go about logging in here.
1. To login you need 3 things
1. Username in the form firstname.lastname@example.org
3. Security Token
To get the security token for a user go to setup>Reset your security token. This will then be emailed to you.
Logging into an Administrators account seems to be different than logging into a normal users account.
For Administrators you have to set the protocol to 'http' for normal users set it to 'https' in addition we have to add the token to the password as follows.
- private var _conn : Connection = new Connection( );
- private function login( username : String, password : String,
- token : String, isAdmin : Boolean = false ) : void
- _connection.protocol = isAdmin ? 'http' : 'https';
- var login : LoginRequest = new LoginRequest( );
- login.username = value..username;
- login.password = value..password.toString( )
- + value..token.toString( );
- login.callback = new Responder( loginResult, loginFault );
- _connection.login( login );
A fellow Senior Rich Internet Applications Developer at work Sam found a nice new undocumented attribute in the Systems package today. vmVersion seems to return the current Flash player virtual machine running on your computer. Mine, and Sams for that matter traces out as 1.0 cyclone. Not sure how useful this is but interesting none the less.