Ashvin Savani “arckid” – Flash Platform Expert

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

Archive for the ‘Flash’ Category

Adobe CS4 is unveiling on 23 September!

Just read on and It’s official.

Adobe is going to unveil Adobe Creative Suite 4 on 23rd September, 2008. If you are ready to feel something brilliant, Register yourself here:

Excited to see it in action!

UPDATE: Adobe is NOT launching but just unveiling more information about CS4 on that day.

  • Filed under: Adobe, Flash, News
  • Meeting – Creating IMAP client with Adobe AIR – Part 1

    Hello friends,

    Today, Once again We came up with interesting meeting series. Instead of just one speaker, We are including many speakers who have expertise in different topics. As mentioned in the meeting topic, Here are the modules we are planning to include in whole series of meetings:

    1. Basics of AIR. (By Ashvin Savani)
    2. Basics of Protocol. (By Ashvin Savani)
    3. Basics of IMAP. (By Ashvin Savani)
    4. How to understand any protocol specifications from specification document / RFCs.
    5. Basics of Socket Communication in Flash Action Script 3.
    6. Handshaking with IMAP Server.
    7. UI – Login Screen.
    8. UI and Event Handling.
    9. Authentication with IMAP Server.
    10. Retrieving Folder Structure from Server.
    11. UI – Displaying Folder Structure.
    12. Retrieving Email headers for given folder (From, To, CC, BCC, etc.,).
    13. Retrieving Email data for given email.
    14. Separating Email Body and Attachments from email data.
    15. UI – Displaying Email Body.
    16. Decoding Email Attachments in to file data.
    17. (Not Sure – For Now) Scan the file via anti virus tool before display it.
    18. UI – Displaying whole email.
    19. UI – Replying email.
    20. Basics: Sending an email via SMTP.
    21. SMTP specifications and normal procedures.
    22. Handshaking with SMTP.
    23. Sending an email with SMTP.
    24. Final touch up to the application.
    25. Lessons Learnt by each attendee.

    I hope, all of us will really enjoy this series and it would be meaningful add on pack to the knowledge of everyone of us:

    As usual, Sponsor for Event, Place and Equipments is Avinashi and FlashBrain.

    Part 1 – Venue and Time:

    FlashBrain Unit, Avinashi Systems.
    Seminar Hall, 2nd Floor,
    Kohinoor Complex, Saiyedpura,
    Surat – 395 003.

    User Group ManagerAshvin Savani
    User Group Co-Manager
    Naresh Khokhaneshiya


    • We were able to finish 3 topics on first part of our meeting on 2nd Aug 08.

    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.

  • 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.

  • Filed under: AIR, Adobe, Flash