Adding a Flash File Inside an ExtJS 4 Component
The Web Dev Zone is brought to you in partnership with Mendix. Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.
Today we are going to learn how to add a flash file (.swf) inside an ExtJS 4 Component.
First, let’s check out what we are going to implement:
What we are going to need for this example:
- ExtJS 4 SDK
- A flash file (I downloaded one from here: http://www.flasheezy.com/)
- SWFObject library: http://code.google.com/p/swfobject/downloads/list (first one from the list)
The first thing to do is to create the project structure. Unzip the SWFObject lib inside the project and also add the flash file you want to display inside the project directory as well (mine is called airballoon). I also unzipped the ExtJS 4 SDK inside the directory and created a file named index.html. When everything is ready, this is how it is going to look:
Finally, inside the index.html file we are going to add the following content:
The flash animation will be displayed inside an ExtJS 4 Window. The class Ext.flash.Component (xtype: ‘flash’) does all the ‘magic’ we need, and in the config url you just need to add the full path to the flash file (.swf).
Complete source code: https://github.com/loiane/extjs4-flash-video