|
Developer ::
Flash Resources ::
Make your Flash
application backwards
compatible
By Tom
Fitzgerald
Writing Flash programs can
be challenging because not all web browsers and
computers are the same. Flash provides a
quality presentation most of the time
everything works fine on different platforms as
long the Flash plug-in is installed. But what
if you write an application for Version 8 and
the viewer has Version 7? The short answer: it
is a debacle. The Flash quality we have lauded
here disappears in a flash (no pun
intended)
What is the solution? With
a little ingenuity, the Flash player version
can be readily identified and then the content
for the user can be tailored based on the
version that the end user has. A good example
of this technique can be seen on
www.QACChamber.com . The navigation on the
left and the top bar uses this technique. What
it does is after it finds the version of Flash
it will either show the more advanced animated
version (if they have Version 8 or higher) or
show a static image (if they have Version 7 or
lower). This technique of designing Flash has
been a real difference maker for our clients.
Our designers have seen too many web sites
where this Flash has not been used, leading to
disastrous consequences for often unwitting
client that does not realize the problem
because the web site looks just fine on the
client's browser who has Version 8. Our web
designers have also seen too many web sites
where a older version is recognized by the web
site which directs the user to Macromedia's
site to get the latest version. How many end
users are going to go through the process of
loading new software just to view the web
site? Certainly, some will but some will not,
and this means lost customers for the
client. Admittedly, this approach is sometimes
required for some full Flash web sites for
technical reasons that need not be addressed
here but but if you are using Flash as a single
weapon in a larger arsenal as our web site
designers typically do, then this technique
will suit provide a far better outcome for the
client.
Now, on to the technical
explanation of how this technique is
developed. In the example illustrated below,
we have created two frames, in the first frame
has the static image for an older player that
cannot handle Version 8's animation, and
anti-aliased for text features. So then in
frame number 2, we put in the movie clip with
the sophisticated animation imagery that
Version 8 can receive.
Step by
Step
From there, in the first
frame, we put the following into the Action
Frame (Hit F9 if it's not visible).
playerVersion =
System.capabilities.version;
temp = substring(playerVersion, 5, 1);
if(temp >= 8) {
play();
} else {
stop();
}
To explain what this does; line
by line.
playerVersion =
System.capabilities.version;
This references the
System.capabilities.version variable and stores
it into a variable we created called
playerVersion. The value of player version is
now ...
WIN 8,0,22,0
Easy enough, but we are not home
yet. We need to get the major version number
(Version 8 in this case) so we can do an
'if..then' statement. So now onto the next
line.
temp = substring(playerVersion, 5,
1);
This uses the substring function
and references the playerVersion variable. It
then takes the fifth letter and stores it in
the variable temp. The "...5,1)" means to take
the fifth character and the 1 means to only
take 1 character. So now we have the major
version number in a variable.
if(temp >= 8) {
play();
} else {
stop();
}
Now we say essentially iIf the
version is 8 or higher, move to frame two, if
it is less than Version 8, stay on the first
frame. This will enable us to have the basic
image on the first frame and the high tech
stuff on the second frame.
Download the Source Code for this
application
Contact Us for
further information
|