Flash Site Optimization

One very important thing that a lot of web developers forget is making a site that is optimized. What I mean with optimized here is for the site to only do things and load things that is necessary for the it to perform properly.


It is understandable since computer and internet connection are getting faster and faster, that developers sometimes forget about those still using a 56K dial up connection. I myself don’t normally invest too much time into optimizing the sites I develop until I started working at my current company where they pay attention to every pixels, download time and always pushing and changing stuff to get the end result better and better. I guess that is what separate a good site and a great one. It is a lot of hassle, but I believe these small and yet actually important details are the things that can help get your skill and knowledge to the next level. Am I glad to be around all these talented people or not?


Back to the topic. There are 2 ways to tune up your site. First is through the client side elements, and Second is through the server side.

1. Client Side

-Refactoring. - This one is obvious. The lesser the lines of codes that you write, the smaller the file size is going to be. Sometimes it is good to refactor your code to improve perfomance, since the second time round you look at the code you can actually take out a good chuck of unnecessary code excecution.
-Assets optimization. - Cutting down the file size of the image assets used in Flash. For example often times using an image with quality 90% and 60% is almost the same visually. So why use 90% if 60% looks alright.
-Omit trace actions. - For the final release it is good to omit trace actions. First it prevents people from seeing the swearing you use in your trace statement. Secondly, it can also cut down your file size quite a lot depending on how much you put traces in the codes.
-Asset / Font sharing - This one is a good one. Most Flash sites now use multiple files that is loaded by the master.swf file. So instead of embedding fonts and exporting assets in every single external component, sharing those might cut down size tremendously. Check out Informit if you need to find out how to do this.
-Class Exclude. - This one is also a good one. Basically what this means is that instead of having to export every classes in every external clips, you might be able to share some of those classes that are used across the clips. Check out www.martijndevisser.com if you need to find out how to do this.


2. Server Side

-Caching. - Turning this on means that components that has been loaded once does not have to be loaded again and again.

In Apache webserver this is how to turn this thing on

First you have to turn on this module LoadModule expires_module modules/mod_expires.so

Second add this codes
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType application/x-shockwave-flash “access plus 1 months”
ExpiresDefault “access plus 1 days”


The above tips should be able to save quite a bit of loading time. I am sure there are more ways to even improve perfomance further. So feel free to drop a line to share it.


Add comment

Utilizing Webservices

A few weeks ago, I was asked to translate a script that I wrote in ASP a year ago to Perl, which I did, because the client wanted the project to be written in Perl.


Well, can’t blame the client since ASP is kind of outdated anyway.


Later on, I was thinking to myself that it won’t be very fun for me to rewrite the script again everytime a client wants the server script to be in a different language that I don’t yet have.


So I decided to write a Web Service for that particular script. I think that it is a very useful tool and would love to encourage other people to start utilizing it or at least get familiar with it.


Web Service, just like its name implies is a “service”. The major advantage is that different platforms and programming languages can use the “service”.


Since this post is targeted to encourage people to take a look at Web Service, I am only going to give a preview of things that can be done using Web Service.


This Flash movie utilize the Web Service that I wrote here to get the distance between 2 US zipcodes



If you have SOAP package for PEAR and some other prerequisite packages like Mail_Mime, Net_URL, HTTP_Request, and Net_DIME installed, you can also use the following PHP script to utilize the Web Service previewed in the Flash movie above.


$soap = new SOAP_WSDL('http://capcai.indorelation.com/webservices/ZipWS.php?wsdl');
$proxy = $soap->getProxy();

$hasil = $proxy->getDistance("78741", "90010", "mi");
print_r ($hasil);


Surprised? It takes only 6 lines of code to access and display the output.


If you are interested in learning more about Web Service, Alessandro Crugnola of sephiroth.it has written a very nice tutorial here.


Add comment

Client-side script for detecting NS6.x and IE5.x without using the navigator object’s properties

The navigator’s object properties are the most common technique used for browser detection.


In this post, I am just trying to find an alternate way to do browser detection.


A logical alternative would be to use the document object and try to find functions or properties that exist in one browser version but not on another.


For example:


document.getElementById is available for IE5+ or NS6+

document.all is available for IE4+


So, one possible solution would be:


if (document.getElementById) { // browser is IE5+ or NS6+
  if (document.all) { // IE4+ only
     // browser is IE5+
  } else {
     // browser is NS6+


Wondering how this can be useful? Well, who knows if this might come out as one of your interview questions. ;p


Add comment