Skip to content

Instantly share code, notes, and snippets.

@georgemarshall
Created November 10, 2012 01:07
Show Gist options
  • Save georgemarshall/4049351 to your computer and use it in GitHub Desktop.
Save georgemarshall/4049351 to your computer and use it in GitHub Desktop.
Creates an Ember view that wraps SWFObject
(function() {
/**
* Creates an Ember view that wraps SWFObject
**/
Ember.SWFObjectView = Ember.View.extend({
attObj: {},
parObj: {},
expressInstall: 'expressInstall.swf',
version: '9.0.0',
template: Ember.Handlebars.compile('<p>This device doesn\'t appear to have flash support.</p>'),
_rerender: function() {
this.rerender();
}.observes('attObj', 'parObj', 'version'),
didInsertElement: function() {
if (swfobject.hasFlashPlayerVersion(this.get('version'))) {
swfobject.createSWF(this.get('attObj'), this.get('parObj'), this.get('elementId'));
} else if (this.get('expressInstall')) {
swfobject.showExpressInstall(this.get('attObj'), this.get('parObj'), this.get('elementId'));
}
},
willDestroyElement: function() {
swfobject.removeSWF(this.get('elementId'));
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment