- slide 1 of 4
In part one, we looked at some reasons why it may be advantageous to embed your SWF file using SWFObject. Here, we conclude by giving an overview of the SWFObject API. Before proceeding, you may want to refresh your memory on the document object model or DOM, by reading the BrightHub tutorial here.
- slide 2 of 4
The SWFObject API
For Version 2, there are 10 API for the swfobject function, and in alphabetical order they are as follows:
1. addDomLoadEvent: This method is primarily for standard browsers such as Internet Explorer, Safari, Opera, and for browsers that use the Gecko engine, like Firefox. It allows the browser to execute a function when a web page is loaded. Other browers need to use addLoadEvent.
3. createCSS: Use this method to create cascading style sheets on the fly.
4. createSWF: This allows you to create and embed a SWF on the fly. You can specify the SWF's height and width, and pass param names and values.
5. embedSWF: Allows you to embed the SWF into your html page, on the fly. This is the opposite of embedding the SWF statically.
6. getObjectById: Returns the ID attribute of an active object, which you can then use to manipulate it. This is for static embedding only.
8. hasFlashPlayerVersion: When you wish to find out which Flash player version a browser is running, use this method to return a Boolean true or false value.
10. removeSWF: This allows you to dynamically remove a SWF from a page. For example, you can write a function that removes a SWF when the user clicks a button.
- slide 3 of 4
Native ActionScript Methods
- slide 4 of 4