Created
November 10, 2012 01:07
-
-
Save georgemarshall/4049351 to your computer and use it in GitHub Desktop.
Creates an Ember view that wraps SWFObject
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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