Good news on Flex, AIR and AS 3.0 books in India

October 31, 2007

Good news on Flex, AIR and AS 3.0 books in India. The following titles are made available by Shroff Publishers in Indian editions:

  • ActionScript 3.0 Cookbook – Published March 2007
  • Programming Flex 2 – Published June 2007
  • Apollo for Adobe Flex Developers Pocket Guide – Published July 2007
  • Essential ActionScript 3.0 – Published September 2007
  • ActionScript 3.0 Design Patterns – Published October 2007

These books may not be available on the shelves in Indian bookstores, which are small compared to the size of US bookstores, but stores are able to order them. Here’s a link to the Shroff site that shows their retailers in Bangalore

Flex Charts – showDataTips Vs showAllDataTips

October 31, 2007

showDataTips is a property on the chart that activates an on-demand display of data-tips on the chart that gets activated only when the mouse is placed over the data point. Setting the property to true yields a result as below…

And the code looks like this…

<mx:PieChart id=”myChart” dataProvider=”{expenses}” showDataTips=”true” >
<mx:PieSeries field=”Amount” nameField=”Expense”/>
<mx:Legend dataProvider=”{myChart}”/>

With showAllDataTips set to true the data-tips for all data points show up de-facto on the chart. Though this might be too much information on screen sometimes, it works well in other situations as this one. It also obviates the need for legends in the chart, if used tastefully

The code is as below…

<mx:PieChart id=”myChart” dataProvider=”{expenses}” showAllDataTips=”true” >
<mx:PieSeries field=”Amount” nameField=”Expense”/>

Shantanu in Bangalore

October 30, 2007

Mr. Shantanu Narayen, the President & COO of Adobe Systems was here in Bangalore, India. We had an RIA Leadership Summit at Oberoi Bangalore, where a lot of industry leaders from various IT Companies from across India attended the talk about Adobe’s vision and plans for the Rich Internet Application space. I’m still waiting for the photos to come in, I’ll upload them as soon as I have it.

I’m happy to say that I was instrumental in bringing together Shantanu and Kamla Bhatt, the host and producer of the Kamla Bhatt Show. She is also a journalist for PodTech and she did 2 interviews of Shantanu for PodTech. Here they are…

1. Here Shantanu talks about Adobe’s vision and strategy

[podtech content=]

2. This one deals with Adobe’s foray into the mobile space with FlashLite and Adobe’s plans for India

[podtech content=]

FullScreen using ContextMenu

October 30, 2007

I had, long back written a post on how to take an application full screen. This is an extension to that. What I am doing is adding the “Go Full Screen” and “Exit Full Screen” buttons on the Context Menu itself (ContextMenu is the Menu that appears on the right click on a Flash Movie). It is a simple application with just an image in it, which is purposely stretched to 100% (using the maintainAspectRatio and scaleContent properties on the Image control).

Application | Source

Note: You will still need to alter the HTML Template to accommodate the full screen as mentioned in this post

Update March 07 2008: A lot of people have complained that they got a security error when they tried using the code above. Here is a post articulating the problem and the solution.

FlexBuilder to be offered free to students

October 26, 2007

This is one news that I wanted to shout from every rooftop, the day I heard it. But I’ve had to restrict myself, but no more !!!

Adobe announced that it is offering FlexBuilder2 at no cost to students and faculty at educational institutions worldwide. This would be made available starting early November this year. The official press release is available online at Yahoo News

Publishing and Viewing a VideoStream using Flex & FMS

October 20, 2007

This post deals with how you would publish and broadcast an Audio and/or Video Stream using FMS (Flash Media Server) and Flex.

You would need to have FMS installed on your system (you can get a free developer edition if you don’t have one) and Flex of course 🙂

To publish a stream, you would require a WebCam and/or Microphone hardware. You would also require the following files

publish.mxml |

Now lets look at publish.mxml. These are the steps to be followed

  • A NetConnection Object has to be used to connect to the FMS Server. This is done in the initConnection() method in the code.
  • The client propery of the NetConnection Object is set to a particular class (Indicates the object on which callback methods should be invoked.)
  • objectEncoding is set to AMF0 (Action Message Format) since FMS2.0 is built on AS2 which uses AMF0 while Flex is built on AS3 which streams using AMF3 by default.

Once the connection is established using the NetConnection Object, it generates a netStatus Event. You can then tap into this event and check if the connection is established. Once the connection is established you can publish the stream, using the NetStream Object.

Once the stream is published, you can write another application to tap into it…. Here’s an example that lets you do that.



Database in AIR – Async Access

October 20, 2007

As my recent explorations into AIR, I decided to take a look at using DataBases with AIR. AIR runtime comes with an embedded SQLLite DataBase. You have the flexibility of opening a DB on the file system or if required, you can even start an in-memory DB that lasts only for a single session (you could potentially use this to store periodic data that gets generated due-course the session and then query it)

A lot of others have done examples on this, but I’ll post mine nonetheless. These examples are using the Asyncronous way of updation, which mean that I’m writing listeners at each point to know if the connection has been established, SQL statement executed…etc

Anyone who has a very basic knowledge of SQL and have used it any language (I have some experience in Java) will find the AS way as intuitive as their own language APIs. Here are the basic classes used

  • A SQLConnection object to establish the connection to the DB
  • A SQLStatement object to which you need to put in your SQL Query
  • When the SQLStatement is executed, it generates one of the following
    • A SQLErrorEvent if the statement fails on execute
    • A SQLEvent.RESULT if the execute is successful
  • A SQLResult that can be got by invoking the getResult() method on the SQLStatement, once the execution is successful

It is possible to do a synchronous way of accessing DB in AIR, I’ll discuss that later. But this time its async access of DB. There are 2 examples one with a in-memory DB and other where the DB is on the file-system itself. I have abstracted the AS code into a separate file and reused it for both the examples.

ExternalDBExample | InMemoryDBExample

AsyncDBScript (AS File) – contains the AS Code