sandbox violation – find answers to your Flex questions…

February 17, 2009

  • How can we speed up the performance of DataGrid when there is a lot of data?
  • How do we reduce SWF size so that the download times are lesser?
  • My Flex application works fine when run from Flex Builder, but when deployed to server, I get security related errors. Why?

You always had questions like this and never knew where to go to get answers? Anirudh Sasikumar, a Technical Evangelist at Adobe has created a project called sandboxviolation. In his own words, sand box violation isΒ  “for the flex and flash community where users can post questions / answers and vote a question or answer up or down earning reputation points along the way”.

Its available in 2 flavors:

Flex App on Google App Engine | An AIR app with offline support

Check it out, benefit from it, post your questions, answer other’s questions, vote answers up/ down and help the community churn high quality content…

Addendum: Anirudh’s written a Syntax Highlighting in AS3 as part of the above project which is awesome and then opensourced the code which has now created quite a buzz. Check it out too πŸ™‚

Advertisements

Won the Yahoo! Hackday, thanks to Flex :)

February 15, 2009

Just back from the Yahoo! Open Hackday India. It was 2 days of mayhem, hardcore coding and fun.I teamed up with Harish for the event and was looking forward to having some fun…

Since I was a speaker at the last HackDay, I knew that it was 24 hrs of hacking and then a 90 seconds elevator pitch at the end of it. Me and Harish decided to make a hack in an improved version of colrful. It integrated Color Search on Flickr, Photos based on reverse geo-coding, Boss Image Search and more… We were really excited.

Once we started hacking, I had a crazy idea. Why don’t we build an application in 90 seconds. An on-stage demo that would be fun and show the power of Flex. We built a fully functional Boss Image Search Application in 90 seconds. What’s awesome is that its just 13 lines of code. We used a HTTPService to connect to the Boss Image Search service and bound the results to the display shelf. We even managed to implement pagination and applied a Yahoo! Flex Skin to it.

When we went on stage and started coding, I made some mistakes in coding it up. There was a confusion about the timer and we actually finished just as the 90 seconds bell rang out… The crowd was cheering us and the adrenaline rush was really awesome. You get the code below.

Source

and here’s what it resulted in:

Though we did not win for colrful, we won the prize in the Best “Gone in 90 seconds” category and won an iPod Touch. It was really the power of Flex that made this crazy idea possible. I am proud that I am the Flex Evangelist. Go Flex!


“Top 10 Mistakes when building Flex Applications” – My 2 cents

April 22, 2008

InfoQ.com (Information Queue) is an independent online community focused on change and innovation in enterprise software development targeted at architects, technical team leads, developers and project managers.

Recently our very own James Ward, teamed up with the team at InfoQ to write an article on “Top 10 Mistakes when building Flex Applications”. Read the rest of this entry »


Happy New Year…

January 2, 2008

Just back from a vacation to my hometown… I have been un-plugged from the web for the past week.

I was trying to catch up with some happenings in the RIA world and came across some posts which I thought I should share here

HAPPY NEW YEAR to everyone…


Security in Flex – Demystified !

October 12, 2007

This is for people who are searching for places to get information on FlashPlayer/AIR Security and for guidelines on creating secure applications.

  1. This link will provide you an overview of Flash Player Security with details on the Flash Player APIs for the same
  2. This link talks of AIR Security and of the additional sandboxes in AIR and how to work with them
  3. A really informative presentation done by Deneb Meketa at MAX2007
  4. Lucas Adamski’s Blog – State of Security

The above links should give you a good idea about security with AIR & Flex and how to create applications that leverage them.


What is mx_internal ?

September 3, 2007

Traditionally in OOO languages access specifiers are used to control visibility of declarations (public, private, protected). Now with XML based languages like MXML making debut, a new mechanism for controlling visibility of declarations has evolved… using namespaces. Namespaces are essentially custom access specifiers, which can have names of your choosing. Namespaces are outfitted with a Universal Resource Identifier (URI) to avoid collisions, and are also used to represent XML namespaces when working with E4X.

What I’m interested in discussing here is an internal namespace that FLEX framework uses for its internal data, called mx_internal. A lot of variables in Flex are mx_internal variables and are available to the developers if they use the mx_internal namespace. Before we go into the details of how to use them… lets look at how to identify these variables. There are 2 ways to do this…

One is the straight forward way of looking into the source. Since Flex is Open Source and comes bundled with the source code.. one can easlily locate these variables in the source. For example, under the class defenition of VideoDisplay.as, you can see the an mx_internal variable called videoPlayer (of type VideoPlayer, which in turn extends from flash.media.Video)

mx_internal var videoPlayer:VideoPlayer = null;

This way of identifying mx_internal variables is not always effective, so a better way is to use FlexBuilder to identify them. This is what you need to do…

  1. Switch to Flex Debugging View
  2. Use the following code
      <mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”&gt;
      <mx:Script> <![CDATA[
      public function debug():void{ } ]]>
      </mx:Script>
      <mx:VideoDisplay id=”vid”/>
      <mx:Button label=”Debug” click=”debug()”/>
      </mx:Application>
  3. Make sure that you can view the mx_internal variables in the debugging mode. You can do this by checking the options in the debug Layout as below
  4. Now put a break point in the debug() function and run the app in the debug mode. Click on the button to come to the debug view and add a watch for the VideoDisplay object. You’ll see the following in the debug view, when you search for videoDisplay under the watched vid variable…

The variables are color coded as below

  • Red Rectangle – private
  • Green Circle – public
  • Yellow Rhombus – mx_internal
  • Char codes “C” & “S” – constants and static vars

Now you have identified the mx_internal variables that you need to use. Now lets see how to use them. This is a 3 step process…

  1. Import the namespace that is going to be used. Note that this needs to be done after all other imports
      import mx.core.mx_internal;
  2. Tell Actionscript that is a namespace
      use namespace mx_internal;
  3. Prefix the property name with its namespace
      vd.mx_internal::videoPlayer.clear();

Thus you can now access and use the mx_internal variable and all its properties, methods, styles etc. I’ll tell you about some scenarios where this is most useful in the coming posts. Hope this makes your job easier πŸ™‚

Addendum (4th Sep ’07) :Β  As rightly pointed out by Mrinal…. I should add this disclaimer.

Adobe uses the mx_internal namespace to mark things that may change in future versions of the framework .. So you have to use it at your own risk, because your inherited class or component may not work with future releases of Flex.


Flex & AS3 Books in India

August 6, 2007

A lot of people complain that there are not enough books on Flex & AS3 in the Indian markets and that they do not know how to get them. This poses a serious threat to the viral adoption of Flex in India. I had a chat on this with John Koch (Adobe Developer Relations Manager, Asia) and he pointed me to some resources.

Shroff Publishers publish a lot of the Oriely books in India and this includes books on Flex2 & AS3 as well.

I haven’t confirmed any, but tomorrow I have decided to phone them and see if these titles are available or not.

Moreover… if you have any more books that you would like to see on Flex, to be published in India, drop me a note. The “Wanna Have List” already includes the following books

  • Rich Internet Applications with Adobe Flex and Java
  • Professional Flex 2 by Rich Tretola, Renaun Erickson & Simon Barber
  • Advanced ActionScript 3 with Design Patterns
  • Essential ActionScript 3

Update 7th Aug 2007:

I called up the retailers asking for the books. They said that if I mail them at their respective email ids, they would get the books for me in a matter of 2-3 days. I did this with the following 2 publishers

1. Gangarams Book Bureau
72, Mahatma Gandhi Road, Bangalore
Phone : 080-25587277 & 25586743
Email : gangarams@vsnl.com

2. Strand Book Stall
S 113 -114, Manipal Centre
Dickenson Road, Bangalore
Phone : 080-25582222
Email : strandbk@bgl.vsnl.net.in

If you dont know where these places are in Bangalore… use Google Maps and search for Gangarams or Strand Book Stall, Bangalore. It will do the trick. Go ahead and order them… Guys in other cities, try this with the book stores in the link given on the above post and let me know, so that I can spread the word πŸ™‚