/* Macromedia(r) Flash(r) JavaScript Integration Kit License Copyright (c) 2005 Macromedia, inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by Macromedia, Inc. (http://www.macromedia.com)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name Macromedia must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact devrelations@macromedia.com. 5. Products derived from this software may not be called "Macromedia" or "Macromedia Flash", nor may "Macromedia" or "Macromedia Flash" appear in their name. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MACROMEDIA OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- This code is part of the Flash / JavaScript Integration Kit: http://www.macromedia.com/go/flashjavascript/ Created by: Christian Cantrell http://weblogs.macromedia.com/cantrell/ mailto:cantrell@macromedia.com Mike Chambers http://weblogs.macromedia.com/mesh/ mailto:mesh@macromedia.com Macromedia */ /** * Create a new Exception object. * name: The name of the exception. * message: The exception message. */ function Exception(name, message) { if (name) this.name = name; if (message) this.message = message; } /** * Set the name of the exception. */ Exception.prototype.setName = function(name) { this.name = name; } /** * Get the exception's name. */ Exception.prototype.getName = function() { return this.name; } /** * Set a message on the exception. */ Exception.prototype.setMessage = function(msg) { this.message = msg; } /** * Get the exception message. */ Exception.prototype.getMessage = function() { return this.message; } /** * Generates a browser-specific Flash tag. Create a new instance, set whatever * properties you need, then call either toString() to get the tag as a string, or * call write() to write the tag out. */ /** * Creates a new instance of the FlashTag. * src: The path to the SWF file. * width: The width of your Flash content. * height: the height of your Flash content. */ function FlashTag(src, width, height) { this.src = src; this.width = width; this.height = height; this.version = '7,0,14,0'; this.id = null; this.bgcolor = 'ffffff'; this.flashVars = null; } /** * Sets the Flash version used in the Flash tag. */ FlashTag.prototype.setVersion = function(v) { this.version = v; } /** * Sets the ID used in the Flash tag. */ FlashTag.prototype.setId = function(id) { this.id = id; } /** * Sets the background color used in the Flash tag. */ FlashTag.prototype.setBgcolor = function(bgc) { this.bgcolor = bgc; } /** * Sets any variables to be passed into the Flash content. */ FlashTag.prototype.setFlashvars = function(fv) { this.flashVars = fv; } /** * Get the Flash tag as a string. */ FlashTag.prototype.toString = function() { var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0; var flashTag = new String(); if (ie) { flashTag += ''; flashTag += ''; flashTag += ''; flashTag += ''; if (this.flashVars != null) { flashTag += ''; } flashTag += ''; } else { flashTag += ''; break; case 'string': doc.xml += ''+this._escapeXml(obj)+''; break; case 'number': doc.xml += ''+obj+''; break; case 'boolean': doc.xml += ''; break; case 'object': if (obj == null) { doc.xml += ''; } else if (obj instanceof Date) { doc.xml += ''+obj.getTime()+''; } else if (obj instanceof Array) { doc.xml += ''; for (var i = 0; i < obj.length; ++i) { this._serializeNode(obj[i], doc, null); } doc.xml += ''; } else { doc.xml += ''; for (var n in obj) { if (typeof(obj[n]) == 'function') continue; this._serializeNode(obj[n], doc, n); } doc.xml += ''; } break; default: throw new Exception("FlashSerializationException", "You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined"); break; } } /** * Private */ FlashSerializer.prototype._addName= function(name) { if (name != null) { return ' name="'+name+'"'; } return ''; } /** * Private */ FlashSerializer.prototype._escapeXml = function(str) { if (this.useCdata) return ''; else return str.replace(/&/g,'&').replace(/