angular-swfobject
Refer to SWFObject github.com/swfobject/swfobject for core library information, this read-me only covers the “new” stuff.
Bower Install
>> bower install hokey.angular-swfobject
All of the pre-existing samples provided on the source repo have been removed on this project. I don't use them for myt own purposes. If someone wishes to add them back and pair them with appropriate documentation, be my guest.
Service:swfobject
The core service that contains the same core logic as swfObject classic. The service has been “angularized”. Angular is the only pre-requiste of this module.
Usage
angular.module('sampleApp',['angular-swfobject'])
.service('consumingSvc', ['swfobject',function(swfobject){
//Here's usage of the loading promise
swfObject.loadedPromise.then(function loadedSuccessfully(){
console.log('eureka!');
});
function swfLoadSuccessCb = function swfLoadSuccessCb(e){
//do something here on successful callback
}
return {
embed: function embed(swfUrlStr, replaceElemIdStr,
widthStr, heightStr, swfVersionStr,
xiSwfUrlStr, flashvarObj, parObj,
attObj, callbackFn){
swfobject.embedSWF(swfUrlStr, replaceElemIdStr,
widthStr, heightStr, swfVersionStr,
xiSwfUrlStr, flashvarObj, parObj,
attObj, swfLoadSuccessCb);
}
};
}]);
1. Syntax updated, with some excteptions, to be jsLint compliant in strict mode.
* Use of deprecated callee replaced with named functions
2. Promise added for clalback on swf load completion.
* Private member: flashLoaded * Public exposed as a service property: loadedPromise
3. Function added that overrides the “one and done” nature of loading the swf plugin
* Public function: overrideDetection * Resets a controlling bool and recalls testPlayerVersion