Apache Flex

Tuesday, June 11, 2013

How to go to top or bottom of a datagrid without doing scrolling in Flex

When we have some functionality like go to top or go to bottom, we need to go to top or bottom of the datagrid or text area by just clicking a link or button in the screen.

At that time we can use "verticalScrollPosition" property of a grid or text area.

If you want to go to bottom of the screen, then set it like this :

dgList.verticalScrollPosition=dgList.maxVerticalScrollPosition;

If you want to go to bottom of the screen, then set it like this:

dgList.verticalScrollPosition=0;



Thanks & Regards,
Jigar Oza

Using JSON in Flex

Hello All,

If we want to use JSON encoding or decoding in Flex action script, we need to include a third party library file to use it. That third party library file is "as3corelib.swc".

Following are the steps to use JSON through as3corelib.swc in a Flex project:

  1. Download the source archive (Note: the project moved from Google Code to github).
  2. Unpack it to a folder.
  3. In Flash Builder 4 select “File” > “New” > “Flex Library-Project”
  4. Enter a name (e.g. “as3corelib”)
  5. Select the directory of the unpacked projects
  6. Select in the section “Flex SDK-Version” Flex 4.1 (or higher), if this is not your standard SDK.
  7. And this is important: Select “Include AIR-Runtime-Libraries” – otherwise you’ll get include errors
  8. Click on the “Done” button
  9. Now you’ve got a brand new Flex library project
  10. Launch the “application” by “Run” > “Run main”
  11. This should result to a fresh compiled “as3corelib.swc” in your bin path of the unpacked as3corelib source archive

After as3corelib.swc is prepared, include it into your Flex project.

After including it into your project you can use it without creating any object. Sample code to use it is:

JSON.encode(string)

or

JSON.decode(string)






Thanks & Regards,
Jigar Oza