SWFObject
Encyclopedia
SWFObject is an open-source JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

 library
JavaScript library
A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies....

 used to embed Adobe Flash
Adobe Flash
Adobe Flash is a multimedia platform used to add animation, video, and interactivity to web pages. Flash is frequently used for advertisements, games and flash animations for broadcast...

 content onto Web page
Web page
A web page or webpage is a document or information resource that is suitable for the World Wide Web and can be accessed through a web browser and displayed on a monitor or mobile device. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext...

s, which is supplied as one small JavaScript file. The library can also detect the installed Adobe Flash Player
Adobe Flash Player
The Adobe Flash Player is software for viewing multimedia, Rich Internet Applications and streaming video and audio, on a computer web browser or on supported mobile devices. Flash Player runs SWF files that can be created by the Adobe Flash authoring tool, by Adobe Flex or by a number of other...

 plug-in in all major web browsers, on all major operating systems (OS)
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

, and can redirect the visitor to another webpage or show alternate HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....

 content if the installed plug-in is not suitable.

The library is independent, although related external libraries often integrate with it, such as SWFAddress
SWFAddress
SWFAddress is an open-source JavaScript library that enables Adobe Flash/Flex and JavaScript/AJAX websites and web applications to support deep linking, a practice that enables users to link to a specific section or page of the content....

 for deep linking
Deep linking
On the World Wide Web, deep linking is making a hyperlink that points to a specific page or image on a website, instead of that website's main or home page. Such links are called deep links.-Example:...

 and SWFFit for dynamic content scaling.

With the multitude of Flash embedding JavaScript libraries, SWFObject has emerged as the most popular being used by over 2,600,000 modern websites as of 2011, including high-profile websites such as Ask.com
Ask.com
Ask is a Q&A focused search engine founded in 1996 by Garrett Gruener and David Warthen in Berkeley, California. The original software was implemented by Gary Chevsky from his own design. Warthen, Chevsky, Justin Grant, and others built the early AskJeeves.com website around that core engine...

, Windows.com
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, Time.com
Time (magazine)
Time is an American news magazine. A European edition is published from London. Time Europe covers the Middle East, Africa and, since 2003, Latin America. An Asian edition is based in Hong Kong...

, Skype.com
Skype
Skype is a software application that allows users to make voice and video calls and chat over the Internet. Calls to other users within the Skype service are free, while calls to both traditional landline telephones and mobile phones can be made for a fee using a debit-based user account system...

, Discovery.com
Discovery Channel
Discovery Channel is an American satellite and cable specialty channel , founded by John Hendricks and distributed by Discovery Communications. It is a publicly traded company run by CEO David Zaslav...

 and YouTube
YouTube
YouTube is a video-sharing website, created by three former PayPal employees in February 2005, on which users can upload, view and share videos....

.

Usage

SWFObject provides a reliable method of embedding Flash content into a webpage by internally handling the various practices that one must follow in order for different web browsers to display Flash content correctly, and isolating them from the web designer. The developer may interface with the library in a standardized manner, the minimum being a single line of JavaScript code. Therefore even inexperienced web designers without knowledge of the ideal HTML code to embed Flash content, can easily insert Flash content into web pages, and have them reliably work for the widest possible audience (excepting those with JavaScript disabled). Flash content inserted using SWFObject will also work on devices that support JavaScript execution
Client-side JavaScript
Client-side JavaScript is JavaScript that runs on the client-side. While JavaScript was originally created to run this way, the term was coined because the language is no longer limited to just client-side, since server-side JavaScript is now available.-Environment:The most common Internet media...

 (and Flash Player), such as the Wii
Wii
The Wii is a home video game console released by Nintendo on November 19, 2006. As a seventh-generation console, the Wii primarily competes with Microsoft's Xbox 360 and Sony's PlayStation 3. Nintendo states that its console targets a broader demographic than that of the two others...

, PlayStation 3
PlayStation 3
The is the third home video game console produced by Sony Computer Entertainment and the successor to the PlayStation 2 as part of the PlayStation series. The PlayStation 3 competes with Microsoft's Xbox 360 and Nintendo's Wii as part of the seventh generation of video game consoles...

 and Nokia N800
Nokia N800
The Nokia N800 Internet tablet is a wireless Internet appliance from Nokia, originally announced at the Las Vegas CES 2007 Summit in January 2007. N800 allows the user to browse the Internet and communicate using Wi-Fi networks or with mobile phone via Bluetooth. The N800 was developed as the...

, unlike the PlayStation Portable
PlayStation Portable
The is a handheld game console manufactured and marketed by Sony Corporation Development of the console was announced during E3 2003, and it was unveiled on , 2004, at a Sony press conference before E3 2004...

.

A major disadvantage with SWFObject is that visitors with JavaScript disabled in their web browsers will not be able to view the Flash content, and will instead see alternate HTML content provided by the web page. For websites that aim to reach the widest possible audience an alternate method is available, by using standards-compliant HTML markup to embed the Flash movie (typically using the tags for the best browser compatibility), and using the registerObject function within the library's API to register the Flash content enabling usage of the other features that the library provides.

Features

SWFObject also includes a few utility functions within its API to retrieve Flash Player related information, such as checking whether a specific version of Flash Player is installed, and a few DHTML utilities to help work with the DOM
DOM
DOM may refer to:*D.O.M. , a restaurant in São Paulo, Brazil*Days on market, how many days since a piece of real estate was listed for sale*Deo optimo maximo, Latin for "to the Greatest and Best God", originally Jove, later the Christian God...

. Because of this, the most common reasons Flash Website developers turn to external JavaScript frameworks such as jQuery
JQuery
jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig...

 or Prototype
Prototype
A prototype is an early sample or model built to test a concept or process or to act as a thing to be replicated or learned from.The word prototype derives from the Greek πρωτότυπον , "primitive form", neutral of πρωτότυπος , "original, primitive", from πρῶτος , "first" and τύπος ,...

 are satisfied internally, giving developers fewer reasons to add additional JavaScript libraries to their website.

The library can also be used to integrate Flash Player Express Install into the webpage, allowing users to install the latest Flash Player without leaving the site, although this requires a browser restart.

SWFAddress

SWFAddress
SWFAddress
SWFAddress is an open-source JavaScript library that enables Adobe Flash/Flex and JavaScript/AJAX websites and web applications to support deep linking, a practice that enables users to link to a specific section or page of the content....

 is a JavaScript and ActionScript library that allows Flash websites to support deep linking
Deep linking
On the World Wide Web, deep linking is making a hyperlink that points to a specific page or image on a website, instead of that website's main or home page. Such links are called deep links.-Example:...

, and can automatically integrate with SWFObject.

SWFFit

SWFFit (formerly known as FitFlash) is a JavaScript library
JavaScript library
A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies....

 used to resize Flash movies according to the browser
Browser
To browse or a browser may, among other concepts, refer to:*Browse, , a kind of orienting strategy in animals and human beings*Browsing , a type of herbivory*A user interface on a computer that allows navigation of objects...

window size, keeping it accessible independent of the screen resolution. SWFFit primarily configures the web browser to display scroll bars when content exceeds the browser window size. It can also be used to dynamically resize the Flash movie size. It is used together with SWFObject.

External links

SWFObject 1.5
SWFObject 2
General
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK