Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move Swiff to MooTools More

  • Loading branch information...
commit e55422cf1f54768fe7336df46bd0426567bf2b08 1 parent 9609878
@arian authored
View
90 Docs/Utilities/Swiff.md
@@ -1,90 +0,0 @@
-# Class: Swiff {#Swiff}
-
-Creates and returns a Flash object using supplied parameters.
-
-### Syntax:
-
- var mySwiff = new Swiff(path[, options]);
-
-### Arguments:
-
-1. path - (*string*) The path to the SWF file.
-2. options - (*object*, optional) See Options below.
-
-### Options:
-
-* id - (*string*: defaults to 'Swiff\_' + unique id) The id of the SWF object.
-* width - (*number*: defaults to 1) The width of the SWF object.
-* height - (*number*: defaults to 1) The height of the SWF object.
-* container - (*element*) The container the SWF object gets injected in.
-* params - (*object*) Parameters to be passed to the SWF object (wmode, bgcolor, allowScriptAccess, loop, etc.).
- * allowScriptAccess - (*string*: defaults to always) The domain that the SWF object allows access to.
- * quality - (*string*: defaults to 'high') The render quality of the movie.
- * swLiveConnect - (*boolean*: defaults to true) the swLiveConnect parameter to allow remote scripting.
- * wMode - (*string*: defaults to 'window') Changes the way the SWF is displayed in the browser.
-* properties - (*object*) Additional attributes for the object element.
-* vars - (*object*) Vars will be passed to the SWF as query string in flashVars.
-* callBacks - (*object*) Functions to call from the SWF. These will be available globally in the movie, and bound to the object.
-
-### Returns:
-
-* (*element*) A new HTML object element.
-
-### Example:
-
- var obj = new Swiff('myMovie.swf', {
- id: 'myBeautifulMovie',
- width: 500,
- height: 400,
- params: {
- wMode: 'opaque',
- bgcolor: '#ff3300'
- },
- vars: {
- myVariable: myJsVar,
- myVariableString: 'hello'
- },
- callBacks: {
- load: myOnloadFunc
- }
- });
-
-### Note:
-
-1. Although Swiff returns the object, this element will NOT have any [Element][] methods applied to it.
-2. The $ function on an object/embed tag will only return its reference without further processing.
-
-## Swiff Function: remote {#Swiff:remote}
-
-Calls an ActionScript function from JavaScript.
-
-### Syntax:
-
- var result = Swiff.remote(obj, fn[, arg, arg, arg ...]);
-
-### Arguments:
-
-1. obj - (*element*) A Swiff instance (a HTML object element).
-2. fn - (*string*) The function name to execute in the SWF.
-3. arg - (*mixed*) Any number of arguments to pass to the named function.
-
-### Returns:
-
-* (*mixed*) The ActionScript function's result.
-
-### Example:
-
- var obj = new Swiff('myMovie.swf');
- alert(Swiff.remote(obj, 'myFlashFn')); // alerts "This is from the .swf file!".
-
-### Note:
-
-The SWF file must be compiled with the ExternalInterface component. See the Adobe documentation on [External Interface][] for more information.
-
-### Credits:
-
-- Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject][].
-
-[Element]: /core/Element/Element
-[External Interface]: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
-[SWFObject]: http://code.google.com/p/swfobject/
View
113 Source/Utilities/Swiff.js
@@ -1,113 +0,0 @@
-/*
----
-
-name: Swiff
-
-description: Wrapper for embedding SWF movies. Supports External Interface Communication.
-
-license: MIT-style license.
-
-credits:
- - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
-
-requires: [Options, Object, Element]
-
-provides: Swiff
-
-...
-*/
-
-(function(){
-
-var Swiff = this.Swiff = new Class({
-
- Implements: Options,
-
- options: {
- id: null,
- height: 1,
- width: 1,
- container: null,
- properties: {},
- params: {
- quality: 'high',
- allowScriptAccess: 'always',
- wMode: 'window',
- swLiveConnect: true
- },
- callBacks: {},
- vars: {}
- },
-
- toElement: function(){
- return this.object;
- },
-
- initialize: function(path, options){
- this.instance = 'Swiff_' + String.uniqueID();
-
- this.setOptions(options);
- options = this.options;
- var id = this.id = options.id || this.instance;
- var container = document.id(options.container);
-
- Swiff.CallBacks[this.instance] = {};
-
- var params = options.params, vars = options.vars, callBacks = options.callBacks;
- var properties = Object.append({height: options.height, width: options.width}, options.properties);
-
- var self = this;
-
- for (var callBack in callBacks){
- Swiff.CallBacks[this.instance][callBack] = (function(option){
- return function(){
- return option.apply(self.object, arguments);
- };
- })(callBacks[callBack]);
- vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
- }
-
- params.flashVars = Object.toQueryString(vars);
- if (Browser.ie){
- properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
- params.movie = path;
- } else {
- properties.type = 'application/x-shockwave-flash';
- }
- properties.data = path;
-
- var build = '<object id="' + id + '"';
- for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
- build += '>';
- for (var param in params){
- if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
- }
- build += '</object>';
- this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
- },
-
- replaces: function(element){
- element = document.id(element, true);
- element.parentNode.replaceChild(this.toElement(), element);
- return this;
- },
-
- inject: function(element){
- document.id(element, true).appendChild(this.toElement());
- return this;
- },
-
- remote: function(){
- return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
- }
-
-});
-
-Swiff.CallBacks = {};
-
-Swiff.remote = function(obj, fn){
- var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
- return eval(rs);
-};
-
-})();
View
3  Specs/Configuration.js
@@ -177,7 +177,6 @@ Configuration.source = {
'Utilities/DomReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx',
'Fx/Fx.CSS',
@@ -228,7 +227,6 @@ Configuration.source = {
'Utilities/DOMReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx.CSS',
'Fx/Fx.Tween',
@@ -278,7 +276,6 @@ Configuration.source = {
'Utilities/DOMReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx.CSS',
'Fx/Fx.Tween',
View
1  package.yml
@@ -41,4 +41,3 @@ sources:
- "Source/Utilities/Cookie.js"
- "Source/Utilities/JSON.js"
- "Source/Utilities/DOMReady.js"
- - "Source/Utilities/Swiff.js"
Please sign in to comment.
Something went wrong with that request. Please try again.