Ashvin Savani “arckid” – Flash Platform Expert

All about RIA development using Flash, Flex, Flash Media Server (Flashcom) with various middleware and backends.

In one of the project we are working on, It requires to do communication between Flash Application (embedded SWF object in the HTML) and the ActiveX control in IE. There are various ways to do communication between a flash object and ActiveX control. Most known method to do such communication is External Interface, If we are talking about Action Script 3 and not previous versions of Action Script.

Embedding a Flash object in a HTML document and embedding it in to a .net application are very different cases. While you are integrating Flash object with Microsoft application development environment, You can drag the Flash object in to the application and can create an instance to deal with it further. While to do the same thing within HTML page instead of application, It’s slight different thing. Here in HTML case, you get instance of Flash object as some variable but you can not do the communication between external environment and flash application as you can do it in normal desktop application.

For example, You can not receive response of function calls you made to parent application as events. If that is desktop application, you can call some functions in parent applications and receive the response as event whenever the application perform desired task at application level and give you result as an event. So, If you are dealing with external communication between flash object and other ActiveX objects embedded in HTML page – you can not do asynchronous communication. So, If ActiveX object is performing long process, You might get an error of “Flash script is taking long time, continue or abort”.

So now question is, How to deal with this situation? And, What kind of ActiveX communication we are dealing with, Which want to take long time to do something? Here are the answers. We are working on ActiveX control which is talking with Microsoft Office applications and process all the tasks or commands given by flash application and return meaningful results. So, If I would like to get a list of all contacts from Microsoft Outlook, it would be enough long task, to produce script is taking too much time, want to abort?

The work around we are currently using is, We had to use JavaScript as a Proxy layer to play a key role in communication between Flash object and the ActiveX control. We are passing or ordering commands to ActiveX control via traditional External Interface way and it just returns that task is accepted by the control or not. Actual result would arrive via Javascript way. So the ActiveX control will call one particular proxy method of Javascript in a same page and which will call a Flash method via External Interface. In Flash, We do receive the unique event name and result that we do expect. Depending on the requirement one can also pass some unique request Ids and expect that back at time of result to make sure, that you are receiving the exact result that you are looking for, not another one with same name!

I am not sure, I will get enough time or not but If I will, Then will post one whitepaper on on FlashBrain site soon.

  • 0 Comments
  • Filed under: Adobe, Flash
  • Support for TIMESTAMP in SQLite with AIR (as local database)

    In past week at FlashBrain, Where do I work; We were working on one cool AIR application with Flash. Naresh – My good friend and colleague at FlashBrain was dealing with timestamps for better algorithm for online and offline sync with AIR.

    We were trying to put timestamp on local and remote database to compare the data based on time to get idea about which record is last updated. Our remote database is MySQL and local database is SQLite which is a part of AIR. TIMESTAMP is a known data type for MySQL and which automatically inserts the timestamp based on whenever you create the record. While, in SQLite it does not support TIMESTAMP as native data type for fields.

    Usually, SQLite converts or casts the data types automatically and in this process it guesses the data types and tries to convert the data in to nearest possible data type. So if you will enter TIMESTAMP like you are doing in MySQL, it will treat the data as numeric and will not solve the purpose for TIMESTAMP. SQLite only supports DATETIME as field data type. This DATETIME is also stored in specific format of DDDD.DDDD which is julian day number expressed as floating point value. So to store TIMESTAMP in to a SQLite with AIR, you need to convert your TIMESTAMP value in to this DDDD.DDDD format before you insert in to SQLite. Also, at time of retrival of data, you need to convert the data in to your desired data type before you use it.

    Here is example, Naresh entered in our internal Knowledge Base, Which we named as Knowledge Dose:

    Inserting the data in to SQLite:

    INSERT INTO <table> (<column>) VALUES (’2008-06-09 07:20:00′);

    here, the important thing is – <column> data type should be DATETIME.

    Fetching the data back from SQLite:

    SELECT datetime(<column>) AS <variableName> FROM <table>;

    I hope this would be helpful to someone!

    AIR – Handling online and offline sync mechanism

    In our recent project with Adobe AIR and Flash CS3, We are working on making offline mechanism to perform best sync in online and offline modes. Normally for Rich Internet Application development, We are using MySQL as database system.

    It’s really fun to work with two database systems, one for online transactions (MySQL) and another for offline transactions (SQLite). Analysis part of data, what should store in online database and what should store in local AIR database. How to maintain sync states? And how to optimize the sync? And when to store data locally and when to fetch data from online database! Yeah, all these questions drives you through all excitement, challenges and fun.

    Specially, in applications which are using user based authentication and if user is offline – That’s a tough case. I am not sure, what we are using is the most efficient way to do that or not; but we are storing encrypted password in local database which successfully authenticated last time. If user is online, it will authenticate credentials via online transaction or with local transaction, if not connected.

    Once user is successfully authenticated via online or offline transaction, In offline case; It’s easy to fetch data from local database and show required data. But in online case, You need to (at least that’s what we are using) show data from local database, for fastest possible data representation. After that we are comparing sync status in background with showing little status update at some corner of the application. If there is no update, no user interaction is required but, if there is any update on server side – We ask user to update the data representation or to stay wherever he is. Based on user’s decision either we discard the data and let him work on local data or we update the local database and refresh the data representation.

    In a special case of, user modifies data while is not connected and someone else is also modified the data between the time when user made last sync and this sync. This case really creates the excitement. This requires timestamp based verification of various data in different tables. Also, this data comparison is not just record to record comparison, but it should be set of data action based on what task user is performing with application. Even this part is easy compare to the situation where you need to handle the merging the data. It’s like you are walking on double edge sword. Any mistake will mess up all the data. You need to take care of all little cases even with 0.001 probability! While working with this application, I was thinking about SVN and Git. Just thinking that how they are managing different versions of files, directories and with many users. And that’s programming all about!

    We are still working on it and I will share all the possible peace of information I can share.

  • 6 Comments
  • Filed under: AIR, Adobe, Flash
  • Google and Yahoo! can search Flash content now

    Adobe announced support and a special version of flash player to Google and Yahoo! to make the searching in Flash or Flex applications or Rich Internet applications better.

    My Personal View:

    This is really a good news for me personally and of course it’s good for all flash developers and who have content in Flash SWFs. So far everyone was trying to optimize their flash applications and other techniques to read XML content to give somewhat assurance that Google or Yahoo! will find something from their content. But now Google and Yahoo! can search and in fact view virtually SWFs and click at every links, menus or buttons like their robots / spiders are doing it with normal HTML content in web pages.

    SEO Industry Perspective:

    This news means a lot for SEO industry as well. Most of my clients were doing argument that, If we are making this whole application in Flash, don’t you think that searching the content would be a problem? Or I will not get much hits through search engines and blah blah. So now, all the flash and flex developers can answer their clients with single sentence that Flash is now search-able too.

    So in deep view, what exactly it does and how everything is possible now and why it was not there before? These are the main question everybody should be asking to their own and trying to find out answers for the same. Here you go:

    Why searching in a Flash content was not possible till now?

    The reason is simple. SWF is a binary file, not an ASCII file where a spider can read it like it is reading some text file. But still, Google and other search engines were trying to read somewhat information about the SWF through the comments posted in HTML file. These comments were generated automatically by Adobe DreamWeaver or by Adobe Flash IDE, while you are generating SWF file or embedding SWF file into the HTML or other scripted pages. So at that time, these IDEs were trying to find out all the static text contents from the SWF files and it was creating a string of all these contents and putting that as comments inside HTML file. So Google and other search engines were able to read that much part of SWF and whatever content was there. So the searching functionality was there but it was too limited. It was not there at all for dynamic contents you are dealing with inside Flash content, which is very common for all the Rich Internet Applications (RIAs).

    Why searching in a Flash content is possible now?

    Now Adobe is trying to open boundaries by opening SWF file format and some other protocols. Adobe wants that more and more third party vendors use Flash SWF as part of their platform, solution or services. So part of that whole strategy, Adobe provided some special version of Flash Player to Google and Yahoo! which they can integrate with their current searching technology tools and spiders to search and store the static and dynamic content in to their database. So with direct help of Adobe, Google and other search engines can virtually surf the Flash content. They can virtually click on various links, menus etc., inside SWF and can store all the data comes in between. So, SWF works like a HTML page and search engines can store the data like they are crawling the HTML pages.

    What I need to do if my site contains SWF files to make them search-able by Google?

    Absolutely nothing! That’s the great part of the deal. Adobe gave Google and Yahoo! a special version of Flash Player and Google already integrated that player into their searching tools / spiders. It also automatically available for all the flash player versions. Means, it really doesn’t matter that your SWF is compatible with Adobe Flash Player version 6 or 9.

    Here is the video from Ryan’s Video, which we can consider as official Adobe statement:

    Other Interesting Links / URLs:

  • 1 Comment
  • Filed under: Adobe, Flash, Flex
  • Project Management (Status) and Mind Maps

    We are small Adobe Flash Platform based development company located in India. We have team of 15 people and mostly we are dealing with 2-3 client projects and 1-2 in house product development. During 5 years of project management (while I was doing freelancing and after), I tried various project management systems to find the best which I can use. Even I like some of them but to check the status everyday, is bit tough. And in case of agile development we are doing, where a single person is working on more than one project and a project contains more than one persons.

    Status part is tough because, your mind need to analyze all tabular data and constantly compare with all the visual image you have of your projects in your mind. It compares about what you hear from the client in the last communication and check, if we are on track or not and all that. Also, if you are running a company, You need to make sure that every team member are doing at their best. Also, company is using all the resources with best or optimum rates. To analyze all this, you might need to have two relationship comparison between tasks v/s developers and developers v/s tasks.

    Mind mapping is a cool idea while you believe more in visuals instead of tabular data or data with full of bullets. I tried MindJet’s Mind Manager which is really a cool desktop mind mapping tool. They also have project management plug-ins to keep track of all of the projects that you are working on. But the negative point is, you need to keep it updated manually all the time. So sometimes it makes you feel like you are more of data entry operation instead of a project manager. So still, It has something missing for me.

    During my test ride of most of the project management systems are not made for you as you are not using a very specific and standard project management. Also, all the projects are not like same and of course same for clients too. In some projects, releases are as frequent like everyday. So it’s too hard to keep track of everything and get whatever information you need at anytime. So I decided to make own project management system, which is also part of our intranet system which we call as Karma.

    I will tell you more about Karma later, but the important feature we developed is called mind map integration of tasks and projects. At end of the day or on request at any time, it generates cool mind map where you will see status by projects and status by team members. So if client calls you for the status, just expand his project branch and keep telling him. We also tried to color all the tasks based on the progress. e.g. If task is not started it would be red and if it’s done it would be green. If progress is there on that, based on percentage of completion of task, it will show you shade between orange and green. I simply love that. As a company owner  you can also check another report / node in the same map where  you can see what every team member is doing on which project and also their tasks with status. What else you need?

    Still seems like, that is not enough! Yeah, its a human nature. Now we are trying to integrate it with different tools like outlook tasks, other desktop based task system and more tight integration with our intranet system – Karma. Once that is done, one can add or update tasks from anywhere and get the reflection for the same real time. We will also provide a view to clients so they can see their relevant information in tabular or map format.

    I will keep posted on maps and project management after few days.