Loiane Groner, Brazilian, works as a Java/ Sencha evangelist. She has 7+ years of experience in web development. She is the ESJUG (Espirito Santo Java Users Group) and CampinasJUG (Campinas Java Users Group) leader and coordinator. Loiane is passionate about technology and programming. Also author of ExtJS 4 First Look book. Loiane is a DZone MVB and is not an employee of DZone and has posted 42 posts at DZone. You can read more from them at their website. View Full User Profile

Adding a Flash File Inside an ExtJS 4 Component

08.20.2012
| 3802 views |
  • submit to reddit

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:

 Adding a Flash file inside an ExtJS 4 Component

What we are going to need for this example:

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:

 Adding a Flash file inside an ExtJS 4 Component

Finally, inside the index.html file we are going to add the following content:

<html>
<head>
    <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
    <script type="text/javascript" src="extjs/ext-all.js"></script>
 
    <script type="text/javascript" src="swfobject/swfobject.js"></script>
</head>
<body></body>
    <script type="text/javascript">
    Ext.onReady(function(){
        var win = Ext.widget('window', {
            title: "Flash animation inside an ExtJS 4 Component!",
            layout: 'fit',
            width: 700,
            height: 500,
            resizable: true,
            items: {
                xtype: 'flash',
                url: 'airballoon/AIRBALLOON.swf'
            }
        });
        win.show();
    });
    </script>
</html>


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).

Demohttp://loiane.com.br/extjs/extjs4-flash-video/

Complete source codehttps://github.com/loiane/extjs4-flash-video

Happy Coding!  Adding a Flash file inside an ExtJS 4 Component

Published at DZone with permission of Loiane Groner, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)