Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Flash to HTML5

DZone's Guide to

Flash to HTML5

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

 

One of the biggest challenges in last 2-3 years has been showing flash animations on devices like IPAD which do not support flash. One alternative is to convert the Flash animation into an HTML5 animation. One of the tools available for this is Google Swiffy. This is one of the best tools available right now. It does a pretty good job of basic flash animations but any flash with advanced action scripting will not be converted correctly.

Once you have HTML5 animation ready, you will need to do some sniffing and display the HTML5 code instead of the swf file,  for devices like IPAD. We present two alternatives for this.

Check if device is IPAD and show HTML5. Sample PHP code is as below.

if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),’ipad’) > 0) {

TRUE implies device is IPAD. Hence show HTML5 animation

Check if there is flash support on the device. If no support, then show HTML5. This approach will show HTML5 animation on any browser which has flash disabled or which does not have flash support. Sample code is as below.

Download the flash detection java script file from http://www.featureblend.com/javascript-flash-detection-library.html

Include the js file “flashDetect.js”
Add the following code to detect flash

<script type=”text/javascript”>
if(!FlashDetect.installed) {

//Add code here

}
</script>

A similar exercise can be done to show videos via HTML5 as HTML5 has native support for videos via the video tag.

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}