﻿<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>System\Browser\assets\scripts\Flash.js 源码</title>
		<link href="../../assets/styles/prettify.css" type="text/css" rel="stylesheet" />
		<script src="../../assets/scripts/prettify.js" type="text/javascript"></script>
		<style type="text/css">.highlight { display: block; background-color: #ddd; }</style>
</head>
<body onload="setTimeout('prettyPrint()', 0);var node = document.getElementById(location.hash.replace(/#/, ''));if(node)node.className = 'highlight';"><pre class="prettyprint lang-js">//===========================================
//  Swf      swiff.js  A
//===========================================

using(&quot;System.Controls.Control&quot;);



namespace(&quot;.Swiff&quot;, JPlus.Control.extend({

	options: {
		id: null,
		height: 1,
		width: 1,
		container: null,
		properties: {},
		params: {
			quality: 'high',
			allowScriptAccess: 'always',
			wMode: 'window',
			swLiveConnect: true
		},
		callBacks: {},
		vars: {}
	},

	constructor: 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 = '&lt;object id=&quot;' + id + '&quot;';
		for (var property in properties) build += ' ' + property + '=&quot;' + properties[property] + '&quot;';
		build += '&gt;';
		for (var param in params) {
			if (params[param]) build += '&lt;param name=&quot;' + param + '&quot; value=&quot;' + params[param] + '&quot; /&gt;';
		}
		build += '&lt;/object&gt;';
		this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
	},

	remote: function () {
		return Swiff.remote.apply(Swiff, [this.node || this].append(arguments));
	}

}));

Swiff.CallBacks = {};

Swiff.remote = function (obj, fn) {
	var rs = obj.CallFunction('&lt;invoke name=&quot;' + fn + '&quot; returntype=&quot;javascript&quot;&gt;' + __flash__argumentsToXML(arguments, 2) + '&lt;/invoke&gt;');
	return eval(rs);
};</pre>
</body>
</html>
