You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2014/03/16 02:00:01 UTC
[01/50] [abbrv] rename folder
Repository: flex-flexunit
Updated Branches:
refs/heads/develop fede2751f -> 360e38257
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
new file mode 100644
index 0000000..e44ac0c
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..ab8a7db
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ import org.flexunit.runner.FlexUnitCore;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f85bf23
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
[25/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f547c33..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
deleted file mode 100644
index b7a4ec9..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt2</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[31/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f547c33
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.project
new file mode 100644
index 0000000..b7a4ec9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt2</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[15/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f547c33
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 893d0e2..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
[03/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f547c33
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
new file mode 100644
index 0000000..b7a4ec9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt2</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/playerProductInstall.swf differ
[35/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f130618..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
-
- public class BasicCircleTest {
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[45/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
updated license information
Posted by jm...@apache.org.
updated license information
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/939c9d3d
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/939c9d3d
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/939c9d3d
Branch: refs/heads/develop
Commit: 939c9d3d36fbda79ebb9f03d0cadb1ea543e11e0
Parents: 12a6f7f
Author: cyrillzadra <cy...@gmail.com>
Authored: Tue Sep 3 11:50:11 2013 +0400
Committer: cyrillzadra <cy...@gmail.com>
Committed: Tue Sep 3 11:50:11 2013 +0400
----------------------------------------------------------------------
FlexUnit4/downloads.xml | 4 ++--
FlexUnit4AntTasks/downloads.xml | 6 +++---
FlexUnit4FlexCoverListener/downloads.xml | 2 +-
FlexUnit4Test/downloads.xml | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/939c9d3d/FlexUnit4/downloads.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4/downloads.xml b/FlexUnit4/downloads.xml
index 3086902..0779c88 100644
--- a/FlexUnit4/downloads.xml
+++ b/FlexUnit4/downloads.xml
@@ -33,8 +33,8 @@
For Apache, the SWCs must be removed from the repository.
Licenses:
- flexunit1lib () - ?
- harmcrest (1.1.3) -
+ flexunit1lib () - TODO license???
+ harmcrest (1.1.3) - (https://github.com/drewbourne/hamcrest-as3/blob/master/hamcrest/LICENSE)
-->
<!--
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/939c9d3d/FlexUnit4AntTasks/downloads.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4AntTasks/downloads.xml b/FlexUnit4AntTasks/downloads.xml
index 1f6e26f..7eedf8c 100644
--- a/FlexUnit4AntTasks/downloads.xml
+++ b/FlexUnit4AntTasks/downloads.xml
@@ -34,9 +34,9 @@
Licenses:
JUnit (3.8.1) - CPL 1.0
- Ant (1.7.1) - ?
- Ant launcher (1.7.1) - ?
- Ant testutil (1.7.1) - ?
+ Ant (1.7.1) - Apache
+ Ant launcher (1.7.1) - Apache
+ Ant testutil (1.7.1) - Apache
dom4j (1.6.1) - ?
jaxen (1.1) - ?
-->
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/939c9d3d/FlexUnit4FlexCoverListener/downloads.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4FlexCoverListener/downloads.xml b/FlexUnit4FlexCoverListener/downloads.xml
index 20248b8..2e80c61 100644
--- a/FlexUnit4FlexCoverListener/downloads.xml
+++ b/FlexUnit4FlexCoverListener/downloads.xml
@@ -33,7 +33,7 @@
For Apache, the SWCs must be removed from the repository.
Licenses:
- CoverageAgent (0.90) - TODO license???
+ CoverageAgent (0.90) - MIT
-->
<!--
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/939c9d3d/FlexUnit4Test/downloads.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Test/downloads.xml b/FlexUnit4Test/downloads.xml
index a0693fb..b197e92 100644
--- a/FlexUnit4Test/downloads.xml
+++ b/FlexUnit4Test/downloads.xml
@@ -35,8 +35,8 @@
Licenses:
fluint (1.2) - MIT
flexunit1lib () - TODO license???
- hamcrest (1.1.3) - TODO license???
- mockolate (0.9.5) - TODO license???
+ hamcrest (1.1.3) - https://github.com/drewbourne/hamcrest-as3/blob/master/hamcrest/LICENSE
+ mockolate (0.9.5) - https://github.com/drewbourne/mockolate/blob/master/LICENSE
-->
<!--
[17/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
new file mode 100644
index 0000000..3ce5674
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.components.layout
+{
+ import flash.geom.Point;
+
+ import mx.core.ILayoutElement;
+
+ import net.digitalprimates.math.Circle;
+
+ import spark.layouts.supportClasses.LayoutBase;
+
+ public class CircleLayout extends LayoutBase {
+
+ private var _offset:Number = 0;
+
+ public function get offset():Number {
+ return _offset;
+ }
+
+ public function set offset(value:Number):void {
+ _offset = value;
+ target.invalidateDisplayList();
+ }
+
+ public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
+ var maxX:Number = (contentWidth/2)*.8;
+ var maxY:Number = (contentHeight/2)*.8;
+ var radius:Number = Math.min( maxX, maxY );
+
+ return Math.max( radius, 1 );
+ }
+
+ override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
+ var i:int;
+ var element:ILayoutElement;
+ var elementLayoutPoint:Point;
+ var elementAngleInRadians:Number;
+ var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
+ var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
+
+ super.updateDisplayList( contentWidth, contentHeight );
+
+ for ( i = 0; i < target.numElements; i++ ) {
+ element = target.getElementAt(i);
+
+ elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
+ elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
+
+ //used to be setActualSize()
+ element.setLayoutBoundsSize( NaN, NaN );
+ var elementWidth:Number = element.getLayoutBoundsWidth()/2;
+ var elementHeight:Number = element.getLayoutBoundsHeight()/2;
+
+ //Use to be move()
+ element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
+ //trace( "x:", elementLayoutPoint.x-elementWidth );
+ //trace( "y:", elementLayoutPoint.y-elementHeight );
+ }
+ }
+
+ public function CircleLayout() {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
new file mode 100644
index 0000000..52022dc
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math
+{
+ import flash.geom.Point;
+
+ public class Donut extends Circle
+ {
+ public static const DONUT_RADIUS_RATIO:Number = 0.2;
+
+ private var _innerRadius:Number;
+
+ public function Donut( origin:Point, radius:Number )
+ {
+ super( origin, radius );
+
+ _innerRadius = radius * DONUT_RADIUS_RATIO;
+ }
+
+ public function get innerRadius():Number
+ {
+ return _innerRadius;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
new file mode 100644
index 0000000..3ce5674
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.components.layout
+{
+ import flash.geom.Point;
+
+ import mx.core.ILayoutElement;
+
+ import net.digitalprimates.math.Circle;
+
+ import spark.layouts.supportClasses.LayoutBase;
+
+ public class CircleLayout extends LayoutBase {
+
+ private var _offset:Number = 0;
+
+ public function get offset():Number {
+ return _offset;
+ }
+
+ public function set offset(value:Number):void {
+ _offset = value;
+ target.invalidateDisplayList();
+ }
+
+ public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
+ var maxX:Number = (contentWidth/2)*.8;
+ var maxY:Number = (contentHeight/2)*.8;
+ var radius:Number = Math.min( maxX, maxY );
+
+ return Math.max( radius, 1 );
+ }
+
+ override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
+ var i:int;
+ var element:ILayoutElement;
+ var elementLayoutPoint:Point;
+ var elementAngleInRadians:Number;
+ var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
+ var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
+
+ super.updateDisplayList( contentWidth, contentHeight );
+
+ for ( i = 0; i < target.numElements; i++ ) {
+ element = target.getElementAt(i);
+
+ elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
+ elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
+
+ //used to be setActualSize()
+ element.setLayoutBoundsSize( NaN, NaN );
+ var elementWidth:Number = element.getLayoutBoundsWidth()/2;
+ var elementHeight:Number = element.getLayoutBoundsHeight()/2;
+
+ //Use to be move()
+ element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
+ //trace( "x:", elementLayoutPoint.x-elementWidth );
+ //trace( "y:", elementLayoutPoint.y-elementHeight );
+ }
+ }
+
+ public function CircleLayout() {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d8724d9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+ [Test]
+ public function shouldGetEqualRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Radius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Diameter():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function get_origin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function test_equals():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
+ var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ assertFalse( circle.equals( circle3 ) );
+ assertFalse( circle.equals( circle4 ) );
+ }
+
+ /*[Test]
+ public function test_getPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+ */
+ /*[Test]
+ public function test_constructor():void {
+ var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+ }*/
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
[11/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
deleted file mode 100644
index ab8a7db..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- import org.flexunit.runner.FlexUnitCore;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f85bf23..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.project
deleted file mode 100644
index 9e8e960..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt3</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf and /dev/null differ
[05/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index 2628e75..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
-
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.fxpProperties
deleted file mode 100644
index 872e071..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="062bea54-96eb-42f3-be43-9384a1276492" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="062bea54-96eb-42f3-be43-9384a1276492"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.project
deleted file mode 100644
index 9e8e960..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt3</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf and /dev/null differ
[44/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
rename folder
Posted by jm...@apache.org.
rename folder
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/68f0bd35
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/68f0bd35
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/68f0bd35
Branch: refs/heads/develop
Commit: 68f0bd35a3d76e135fa5870fa1a082d433efdca1
Parents: 64592fd
Author: cyrillzadra <cy...@gmail.com>
Authored: Sun Sep 1 20:59:40 2013 +0800
Committer: cyrillzadra <cy...@gmail.com>
Committed: Sun Sep 1 20:59:40 2013 +0800
----------------------------------------------------------------------
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Complete/FlexUnit4Training/.flexProperties | 18 +
.../Complete/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/Complete/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/Complete/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training/.flexProperties | 18 +
.../Start/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/Start/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/Start/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/SampleCircleLayout.mxml | 35 +
.../Start/FlexUnit4Training/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../Start/FlexUnit4Training/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../Start/FlexUnit4Training/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../Start/FlexUnit4Training/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../Start/FlexUnit4Training/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../digitalprimates/math/layout/CircleLayout.as | 80 ++
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../completex/FlexUnit4Training/.flexProperties | 18 -
.../completex/FlexUnit4Training/.fxpProperties | 32 -
.../Unit1/completex/FlexUnit4Training/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../Unit1/completex/FlexUnit4Training/build.xml | 104 ---
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../src/net/digitalprimates/math/Donut.as | 40 -
.../tests/math/testcases/BasicCircleTest.as | 85 --
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../startx/FlexUnit4Training/.flexProperties | 18 -
.../startx/FlexUnit4Training/.fxpProperties | 32 -
.../Unit1/startx/FlexUnit4Training/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../Unit1/startx/FlexUnit4Training/build.xml | 104 ---
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/SampleCircleLayout.mxml | 35 -
.../startx/FlexUnit4Training/src/assets/1.jpg | Bin 16146 -> 0 bytes
.../startx/FlexUnit4Training/src/assets/2.jpg | Bin 13636 -> 0 bytes
.../startx/FlexUnit4Training/src/assets/3.jpg | Bin 9528 -> 0 bytes
.../startx/FlexUnit4Training/src/assets/4.jpg | Bin 11967 -> 0 bytes
.../startx/FlexUnit4Training/src/assets/5.jpg | Bin 11536 -> 0 bytes
.../components/layout/CircleLayout.as | 80 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../src/net/digitalprimates/math/Donut.as | 40 -
.../digitalprimates/math/layout/CircleLayout.as | 80 --
.../tests/math/testcases/BasicCircleTest.as | 85 --
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit2/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 22 +
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../FlexUnit4Training_wt1/.fxpProperties | 32 -
.../completex/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 33 -
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../startx/FlexUnit4Training_wt1/.fxpProperties | 32 -
.../Unit2/startx/FlexUnit4Training_wt1/.project | 34 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 22 -
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../FlexUnit4Training_wt1/.fxpProperties | 32 -
.../completex/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 84 --
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt2/.flexProperties | 18 -
.../FlexUnit4Training_wt2/.fxpProperties | 32 -
.../completex/FlexUnit4Training_wt2/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 50 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 94 ---
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt3/.flexProperties | 18 -
.../FlexUnit4Training_wt3/.fxpProperties | 32 -
.../completex/FlexUnit4Training_wt3/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 114 ---
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../startx/FlexUnit4Training_wt1/.fxpProperties | 32 -
.../Unit4/startx/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 33 -
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt2/.flexProperties | 18 -
.../startx/FlexUnit4Training_wt2/.fxpProperties | 32 -
.../Unit4/startx/FlexUnit4Training_wt2/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 84 --
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt3/.flexProperties | 18 -
.../startx/FlexUnit4Training_wt3/.fxpProperties | 32 -
.../Unit4/startx/FlexUnit4Training_wt3/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../libs/flexUnitTasks-4.1.0.jar | Bin 592892 -> 0 bytes
.../src/FlexUnit4Training.mxml | 50 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 94 ---
326 files changed, 21529 insertions(+), 21529 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.project
new file mode 100644
index 0000000..b9587a7
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/build.xml
new file mode 100644
index 0000000..f6e02ba
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/build.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ This build file is intended as a simple example for FlexUnit4Training.
+
+ The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
+ for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
+ -->
+<project name="FlexUnit4SampleProject" basedir="." default="package">
+ <!-- setup a prefix for all environment variables -->
+ <property environment="env" />
+
+ <!-- Setup paths for build -->
+ <property name="main.src.loc" location="${basedir}/src/" />
+ <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
+ <property name="lib.loc" location="${basedir}/libs" />
+ <property name="output.loc" location="${basedir}/target" />
+ <property name="bin.loc" location="${output.loc}/bin" />
+ <property name="report.loc" location="${output.loc}/report" />
+ <property name="dist.loc" location="${output.loc}/dist" />
+
+ <!-- Setup Flex and FlexUnit ant tasks -->
+ <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
+ <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
+
+ <target name="clean">
+ <!-- Remove all directories created during the build process -->
+ <delete dir="${output.loc}" />
+ </target>
+
+ <target name="init">
+ <!-- Create directories needed for the build process -->
+ <mkdir dir="${output.loc}" />
+ <mkdir dir="${bin.loc}" />
+ <mkdir dir="${report.loc}" />
+ <mkdir dir="${dist.loc}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <!-- Compile Main.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+ </target>
+
+ <target name="test" depends="init">
+ <!-- Compile TestRunner.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
+ <source-path path-element="${main.src.loc}" />
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+
+ <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
+ <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
+ toDir="${report.loc}"
+ haltonfailure="false"
+ verbose="true"
+ localTrusted="true" />
+
+ <!-- Generate readable JUnit-style reports -->
+ <junitreport todir="${report.loc}">
+ <fileset dir="${report.loc}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${report.loc}/html" />
+ </junitreport>
+ </target>
+
+ <target name="package" depends="test">
+ <!-- Assemble final website -->
+ <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
+ <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
+
+ <!-- Zip up final website -->
+ <zip destfile="${output.loc}/${ant.project.name}.zip">
+ <fileset dir="${dist.loc}" />
+ </zip>
+ </target>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/playerProductInstall.swf differ
[04/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
deleted file mode 100644
index e44ac0c..0000000
Binary files a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
deleted file mode 100644
index ab8a7db..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- import org.flexunit.runner.FlexUnitCore;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f85bf23..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
[49/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
resolve merge conflicts
Posted by jm...@apache.org.
resolve merge conflicts
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/ce6e3ffb
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/ce6e3ffb
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/ce6e3ffb
Branch: refs/heads/develop
Commit: ce6e3ffb3825e30564c0190a036d0e2ec575c155
Parents: e381d6b 939c9d3
Author: Justin Mclean <jm...@apache.org>
Authored: Sun Mar 16 11:58:07 2014 +1100
Committer: Justin Mclean <jm...@apache.org>
Committed: Sun Mar 16 11:58:07 2014 +1100
----------------------------------------------------------------------
----------------------------------------------------------------------
[36/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f547c33..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 893d0e2..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[13/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f130618
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+
+ public class BasicCircleTest {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
[46/50] [abbrv] Merge branch 'refs/heads/FlexUnitTutorial' into
FlexUnitTutorial2
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/9b92b2f8/FlexUnit4AntTasks/build.xml
----------------------------------------------------------------------
diff --cc FlexUnit4AntTasks/build.xml
index a929fdf,7bb004e..cba9382
--- a/FlexUnit4AntTasks/build.xml
+++ b/FlexUnit4AntTasks/build.xml
@@@ -1,20 -1,20 +1,20 @@@
<?xml version="1.0" encoding="UTF-8"?>
--<!--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
---->
++<!--
++ Licensed to the Apache Software Foundation (ASF) under one or more
++ contributor license agreements. See the NOTICE file distributed with
++ this work for additional information regarding copyright ownership.
++ The ASF licenses this file to You under the Apache License, Version 2.0
++ (the "License"); you may not use this file except in compliance with
++ the License. You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++-->
<project name="FlexUnitAntTasks" basedir="." default="package">
<import file="${basedir}/../utils.xml" />
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/9b92b2f8/FlexUnit4FlexCoverListener/build.xml
----------------------------------------------------------------------
diff --cc FlexUnit4FlexCoverListener/build.xml
index 03572d6,daee11b..90aa9b0
--- a/FlexUnit4FlexCoverListener/build.xml
+++ b/FlexUnit4FlexCoverListener/build.xml
@@@ -1,20 -1,20 +1,20 @@@
<?xml version="1.0" encoding="UTF-8"?>
--<!--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
---->
++<!--
++ Licensed to the Apache Software Foundation (ASF) under one or more
++ contributor license agreements. See the NOTICE file distributed with
++ this work for additional information regarding copyright ownership.
++ The ASF licenses this file to You under the Apache License, Version 2.0
++ (the "License"); you may not use this file except in compliance with
++ the License. You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++-->
<project name="FlexUnit4FlexCoverListener" basedir="." default="package">
<import file="${basedir}/../utils.xml" />
<property environment="env" />
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/9b92b2f8/FlexUnit4Test/build.xml
----------------------------------------------------------------------
diff --cc FlexUnit4Test/build.xml
index 65d065d,d731580..9c89a96
--- a/FlexUnit4Test/build.xml
+++ b/FlexUnit4Test/build.xml
@@@ -1,20 -1,20 +1,20 @@@
<?xml version="1.0" encoding="UTF-8"?>
--<!--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
---->
++<!--
++ Licensed to the Apache Software Foundation (ASF) under one or more
++ contributor license agreements. See the NOTICE file distributed with
++ this work for additional information regarding copyright ownership.
++ The ASF licenses this file to You under the Apache License, Version 2.0
++ (the "License"); you may not use this file except in compliance with
++ the License. You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++-->
<!--
The sole purpose of this project is to create a transitive dependency between the core and cilistener
projects. If the tests resided with the core project, then core and cilistener would have a circular
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/9b92b2f8/README
----------------------------------------------------------------------
diff --cc README
index 4b89781,fe9c096..3c05b2b
--- a/README
+++ b/README
@@@ -1,132 -1,22 +1,131 @@@
-h2. FlexUnit: a unit testing framework for Flex and ActionScript 3.0
+Apache Flex (FlexUnit)
+==================
-FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications and libraries. It mimics the functionality of JUnit, a Java unit testing framework, and comes with a graphical test runner.
+Apache Flex (FlexUnit) is a unit testing framework for Apache Flex and ActionScript 3.0
+applications and libraries. It mimics the functionality of JUnit, a Java
+unit testing framework, and comes with a graphical test runner.
-h3. Features
+Getting the latest sources via git
+==================================
-Some of FlexUnits features include:
-* Support for Flex or ActionScript 3
-* Mark tests with Metadata
-* Async testing support
-* Exception Handling
-* Theories, Datapoints and Assumptions
+ You can always checkout the latest source via git using the following
+ command:
+
+ git clone https://git-wip-us.apache.org/repos/asf/flex-flexunit.git flexunit
+ cd flexunit
+ git checkout develop
-A complete list of features can be found on "the FlexUnit homepage":http://flexunit.org
+ For further information visit http://flex.apache.org/download-source.html
-h3. Documentation
+Building Apache Flex (FlexUnit)
+=========================
-Documentation for FlexUnit can be found at "docs.flexunit.org":http://docs.flexunit.org
+ Apache Flex (FlexUnit) requires some build tools which must be installed
+ prior to building FlexUnit and it depends on some external software which
+ are downloaded as part of the build process. Some of these have different licenses.
+ See the Software Dependencies section for more information on the external software
+ dependencies.
+
+Install Prerequisites
+---------------------
-h3. Code
+ Before building FlexUnit you must install the following software and set the
+ corresponding environment variables using absolute file paths. Relative file paths
+ will result in build errors.
+
+ ==================================================================================
+ SOFTWARE ENVIRONMENT VARIABLE (absolute paths)
+ ==================================================================================
+
+ Java SDK 1.6 or greater (*1) JAVA_HOME
+ (for Java 1.7 see note at (*2))
+
+ Ant 1.7.1 or greater (*1) ANT_HOME
+ (for Java 1.7 see note at (*2))
+
+ Apache Flex (*3) FLEX_HOME
+
+ ==================================================================================
+
+ *1) The bin directories for ANT_HOME and JAVA_HOME should be added to your PATH.
+
+ On Windows, set PATH to
+
+ PATH=%PATH%;%ANT_HOME%\bin;%JAVA_HOME%\bin
+
+ On the Mac (bash), set PATH to
+
+ export PATH="$PATH:$ANT_HOME/bin:$JAVA_HOME/bin"
+
+ On Linux make sure you path include ANT_HOME and JAVA_HOME.
-The code for FlexUnit can be found on "Apache Git Repository":https://git-wip-us.apache.org/repos/asf/flex-flexunit.git
+ *2) If you are using Java SDK 1.7 or greater on a Mac you must use Ant 1.8 or
+ greater. If you use Java 1.7 with Ant 1.7, ant reports the java version as 1.6
+ so the JVM args for the data model (-d32/-d64) will not be set correctly and
+ you will get compile errors.
+
+ *3) FLEX_HOME should be set to a valid Apache Flex installation.
+
+
+Software Dependencies
+---------------------
+
+ Apache Flex (FlexUnit) uses third-party code that will be downloaded as part of the Apache
+ Flex (FlexUnit) build.
+
+ When you have all the prerequisites in place and the environment variables set,
+ (see Install Prerequisites above), use
+
+ cd <flexunit.dir>
+ ant thirdparty-downloads
+
+ The Apache Version 2.0 license is in the LICENSE file.
+
+ The following dependencies have licenses which are, or are compatible with, the Apache
+ Version 2.0 license. You will not be prompted to acknowledge the download.
+
+ (jars)
+ ant - http://search.maven.org/remotecontent?filepath=org/apache/ant/ant/1.7.1/ant-1.7.1.jar (Apache 2.0 License)
+ ant-contrib - http://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar (Apache 2.0 License)
+ ant-launcher - http://search.maven.org/remotecontent?filepath=org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar (Apache 2.0 License)
+ ant-testutil - http://search.maven.org/remotecontent?filepath=org/apache/ant/ant-testutil/1.7.1/ant-testutil-1.7.1.jar (Apache 2.0 License)
+ maven-ant-tasks - http://search.maven.org/remotecontent?filepath=org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar (Apache 2.0 License)
+ dom4j - http://search.maven.org/remotecontent?filepath=dom4j/dom4j/1.6.1/dom4j-1.6.1.jar (BSD License)
+ jaxen - http://search.maven.org/remotecontent?filepath=jaxen/jaxen/1.1-beta-6/jaxen-1.1-beta-6.jar (BSD License)
+
+ (swcs)
+ coverageagent - https://flexcover.googlecode.com/files/flexcover-0.90.zip (MIT License)
+ fluint - https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs/fluint-1_2.swc (MIT License)
+ mockolate - http://cloud.github.com/downloads/drewbourne/hamcrest-as3/hamcrest-as3-flex-1.1.3.zip (MIT License)
+ mock-as - https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs/mock-as3.swc (BSD License)
+ hamcrest - http://cloud.github.com/downloads/drewbourne/hamcrest-as3/mockolate-0.9.5.zip (BSD License)
+ flexunit1lib - https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs/FlexUnit1Lib.swc (BSD License)
+
+ The following dependencies have licenses which Apache considers to be reciprocal
+ licenses so you will be prompted to acknowledge the license before the software is
+ downloaded to your system.
+
+ (jars)
+ junit - http://search.maven.org/remotecontent?filepath=junit/junit/3.8.1/junit-3.8.1.jar (License - CPL 1.0)
+ saxon9he - http://search.maven.org/remotecontent?filepath=net/sf/saxon/Saxon-HE/9.4/Saxon-HE-9.4.jar (License - MPL 1.1)
+
+
+Building Apache Flex (FlexUnit)
+-----------------------------------------------
+
+ When you have all the prerequisites in place and the environment variables set,
+ (see Install Prerequisites above), use
+
+ cd <flexunit.dir>
+ ant
+
+ build Apache Flex (FlexUnit).
+ �
+ To clean the build use
+
+ ant clean
+
+Thanks for using Apache Flex (FlexUnit). Enjoy!
+
+ The Apache Flex Project
+ <http://flex.apache.org>
-
[08/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..ab8a7db
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ import org.flexunit.runner.FlexUnitCore;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f85bf23
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
new file mode 100644
index 0000000..9e8e960
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt3</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf differ
[41/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
deleted file mode 100644
index 52022dc..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math
-{
- import flash.geom.Point;
-
- public class Donut extends Circle
- {
- public static const DONUT_RADIUS_RATIO:Number = 0.2;
-
- private var _innerRadius:Number;
-
- public function Donut( origin:Point, radius:Number )
- {
- super( origin, radius );
-
- _innerRadius = radius * DONUT_RADIUS_RATIO;
- }
-
- public function get innerRadius():Number
- {
- return _innerRadius;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d8724d9..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
- [Test]
- public function shouldGetEqualRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Radius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Diameter():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function get_origin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function test_equals():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
- var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- assertFalse( circle.equals( circle3 ) );
- assertFalse( circle.equals( circle4 ) );
- }
-
- /*[Test]
- public function test_getPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
- */
- /*[Test]
- public function test_constructor():void {
- var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
- }*/
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
deleted file mode 100644
index 85b29aa..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
deleted file mode 100644
index b9587a7..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
[02/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..2628e75
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
new file mode 100644
index 0000000..872e071
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="062bea54-96eb-42f3-be43-9384a1276492" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="062bea54-96eb-42f3-be43-9384a1276492"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
new file mode 100644
index 0000000..9e8e960
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt3</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf differ
[39/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
deleted file mode 100644
index 3ce5674..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.components.layout
-{
- import flash.geom.Point;
-
- import mx.core.ILayoutElement;
-
- import net.digitalprimates.math.Circle;
-
- import spark.layouts.supportClasses.LayoutBase;
-
- public class CircleLayout extends LayoutBase {
-
- private var _offset:Number = 0;
-
- public function get offset():Number {
- return _offset;
- }
-
- public function set offset(value:Number):void {
- _offset = value;
- target.invalidateDisplayList();
- }
-
- public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
- var maxX:Number = (contentWidth/2)*.8;
- var maxY:Number = (contentHeight/2)*.8;
- var radius:Number = Math.min( maxX, maxY );
-
- return Math.max( radius, 1 );
- }
-
- override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
- var i:int;
- var element:ILayoutElement;
- var elementLayoutPoint:Point;
- var elementAngleInRadians:Number;
- var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
- var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
-
- super.updateDisplayList( contentWidth, contentHeight );
-
- for ( i = 0; i < target.numElements; i++ ) {
- element = target.getElementAt(i);
-
- elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
- elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
-
- //used to be setActualSize()
- element.setLayoutBoundsSize( NaN, NaN );
- var elementWidth:Number = element.getLayoutBoundsWidth()/2;
- var elementHeight:Number = element.getLayoutBoundsHeight()/2;
-
- //Use to be move()
- element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
- //trace( "x:", elementLayoutPoint.x-elementWidth );
- //trace( "y:", elementLayoutPoint.y-elementHeight );
- }
- }
-
- public function CircleLayout() {
- super();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d8724d9..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
- [Test]
- public function shouldGetEqualRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Radius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Diameter():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function get_origin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function test_equals():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
- var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- assertFalse( circle.equals( circle3 ) );
- assertFalse( circle.equals( circle4 ) );
- }
-
- /*[Test]
- public function test_getPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
- */
- /*[Test]
- public function test_constructor():void {
- var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
- }*/
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[18/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
new file mode 100644
index 0000000..85b29aa
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
new file mode 100644
index 0000000..b9587a7
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
new file mode 100644
index 0000000..f6e02ba
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ This build file is intended as a simple example for FlexUnit4Training.
+
+ The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
+ for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
+ -->
+<project name="FlexUnit4SampleProject" basedir="." default="package">
+ <!-- setup a prefix for all environment variables -->
+ <property environment="env" />
+
+ <!-- Setup paths for build -->
+ <property name="main.src.loc" location="${basedir}/src/" />
+ <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
+ <property name="lib.loc" location="${basedir}/libs" />
+ <property name="output.loc" location="${basedir}/target" />
+ <property name="bin.loc" location="${output.loc}/bin" />
+ <property name="report.loc" location="${output.loc}/report" />
+ <property name="dist.loc" location="${output.loc}/dist" />
+
+ <!-- Setup Flex and FlexUnit ant tasks -->
+ <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
+ <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
+
+ <target name="clean">
+ <!-- Remove all directories created during the build process -->
+ <delete dir="${output.loc}" />
+ </target>
+
+ <target name="init">
+ <!-- Create directories needed for the build process -->
+ <mkdir dir="${output.loc}" />
+ <mkdir dir="${bin.loc}" />
+ <mkdir dir="${report.loc}" />
+ <mkdir dir="${dist.loc}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <!-- Compile Main.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+ </target>
+
+ <target name="test" depends="init">
+ <!-- Compile TestRunner.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
+ <source-path path-element="${main.src.loc}" />
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+
+ <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
+ <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
+ toDir="${report.loc}"
+ haltonfailure="false"
+ verbose="true"
+ localTrusted="true" />
+
+ <!-- Generate readable JUnit-style reports -->
+ <junitreport todir="${report.loc}">
+ <fileset dir="${report.loc}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${report.loc}/html" />
+ </junitreport>
+ </target>
+
+ <target name="package" depends="test">
+ <!-- Assemble final website -->
+ <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
+ <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
+
+ <!-- Zip up final website -->
+ <zip destfile="${output.loc}/${ant.project.name}.zip">
+ <fileset dir="${dist.loc}" />
+ </zip>
+ </target>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
new file mode 100644
index 0000000..d71afcb
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:layout="net.digitalprimates.components.layout.*" minWidth="955" minHeight="600">
+
+ <s:HSlider id="slider" liveDragging="true" stepSize=".1"/>
+ <s:Group width="100%" height="100%">
+ <s:layout>
+ <layout:CircleLayout offset="{slider.value}"/>
+ </s:layout>
+
+ <mx:Image source="assets/1.jpg"/>
+ <mx:Image source="assets/2.jpg"/>
+ <mx:Image source="assets/3.jpg"/>
+ <mx:Image source="assets/4.jpg"/>
+ <mx:Image source="assets/5.jpg"/>
+ </s:Group>
+
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg
new file mode 100644
index 0000000..70c6dc7
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg
new file mode 100644
index 0000000..8044a3f
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg
new file mode 100644
index 0000000..6f75776
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg
new file mode 100644
index 0000000..4eb99d5
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg
new file mode 100644
index 0000000..3c03b15
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg differ
[34/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..2628e75
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.project
new file mode 100644
index 0000000..b7a4ec9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt2</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..ab8a7db
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ import org.flexunit.runner.FlexUnitCore;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[27/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f85bf23..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
deleted file mode 100644
index 9e8e960..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt3</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[37/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f130618
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+
+ public class BasicCircleTest {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[21/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
deleted file mode 100644
index 52022dc..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math
-{
- import flash.geom.Point;
-
- public class Donut extends Circle
- {
- public static const DONUT_RADIUS_RATIO:Number = 0.2;
-
- private var _innerRadius:Number;
-
- public function Donut( origin:Point, radius:Number )
- {
- super( origin, radius );
-
- _innerRadius = radius * DONUT_RADIUS_RATIO;
- }
-
- public function get innerRadius():Number
- {
- return _innerRadius;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d8724d9..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
- [Test]
- public function shouldGetEqualRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Radius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Diameter():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function get_origin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function test_equals():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
- var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- assertFalse( circle.equals( circle3 ) );
- assertFalse( circle.equals( circle4 ) );
- }
-
- /*[Test]
- public function test_getPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
- */
- /*[Test]
- public function test_constructor():void {
- var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
- }*/
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
new file mode 100644
index 0000000..b9587a7
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
new file mode 100644
index 0000000..f6e02ba
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ This build file is intended as a simple example for FlexUnit4Training.
+
+ The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
+ for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
+ -->
+<project name="FlexUnit4SampleProject" basedir="." default="package">
+ <!-- setup a prefix for all environment variables -->
+ <property environment="env" />
+
+ <!-- Setup paths for build -->
+ <property name="main.src.loc" location="${basedir}/src/" />
+ <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
+ <property name="lib.loc" location="${basedir}/libs" />
+ <property name="output.loc" location="${basedir}/target" />
+ <property name="bin.loc" location="${output.loc}/bin" />
+ <property name="report.loc" location="${output.loc}/report" />
+ <property name="dist.loc" location="${output.loc}/dist" />
+
+ <!-- Setup Flex and FlexUnit ant tasks -->
+ <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
+ <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
+
+ <target name="clean">
+ <!-- Remove all directories created during the build process -->
+ <delete dir="${output.loc}" />
+ </target>
+
+ <target name="init">
+ <!-- Create directories needed for the build process -->
+ <mkdir dir="${output.loc}" />
+ <mkdir dir="${bin.loc}" />
+ <mkdir dir="${report.loc}" />
+ <mkdir dir="${dist.loc}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <!-- Compile Main.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+ </target>
+
+ <target name="test" depends="init">
+ <!-- Compile TestRunner.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
+ <source-path path-element="${main.src.loc}" />
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+
+ <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
+ <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
+ toDir="${report.loc}"
+ haltonfailure="false"
+ verbose="true"
+ localTrusted="true" />
+
+ <!-- Generate readable JUnit-style reports -->
+ <junitreport todir="${report.loc}">
+ <fileset dir="${report.loc}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${report.loc}/html" />
+ </junitreport>
+ </target>
+
+ <target name="package" depends="test">
+ <!-- Assemble final website -->
+ <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
+ <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
+
+ <!-- Zip up final website -->
+ <zip destfile="${output.loc}/${ant.project.name}.zip">
+ <fileset dir="${dist.loc}" />
+ </zip>
+ </target>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
[38/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f547c33
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..893d0e2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[09/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..2628e75
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
new file mode 100644
index 0000000..b7a4ec9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt2</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf differ
[19/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/SampleCircleLayout.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/SampleCircleLayout.mxml b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/SampleCircleLayout.mxml
deleted file mode 100644
index d71afcb..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/SampleCircleLayout.mxml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:layout="net.digitalprimates.components.layout.*" minWidth="955" minHeight="600">
-
- <s:HSlider id="slider" liveDragging="true" stepSize=".1"/>
- <s:Group width="100%" height="100%">
- <s:layout>
- <layout:CircleLayout offset="{slider.value}"/>
- </s:layout>
-
- <mx:Image source="assets/1.jpg"/>
- <mx:Image source="assets/2.jpg"/>
- <mx:Image source="assets/3.jpg"/>
- <mx:Image source="assets/4.jpg"/>
- <mx:Image source="assets/5.jpg"/>
- </s:Group>
-
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/1.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/1.jpg b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/1.jpg
deleted file mode 100644
index 70c6dc7..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/1.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/2.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/2.jpg b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/2.jpg
deleted file mode 100644
index 8044a3f..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/2.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/3.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/3.jpg b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/3.jpg
deleted file mode 100644
index 6f75776..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/3.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/4.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/4.jpg b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/4.jpg
deleted file mode 100644
index 4eb99d5..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/4.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/5.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/5.jpg b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/5.jpg
deleted file mode 100644
index 3c03b15..0000000
Binary files a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/assets/5.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
deleted file mode 100644
index 3ce5674..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.components.layout
-{
- import flash.geom.Point;
-
- import mx.core.ILayoutElement;
-
- import net.digitalprimates.math.Circle;
-
- import spark.layouts.supportClasses.LayoutBase;
-
- public class CircleLayout extends LayoutBase {
-
- private var _offset:Number = 0;
-
- public function get offset():Number {
- return _offset;
- }
-
- public function set offset(value:Number):void {
- _offset = value;
- target.invalidateDisplayList();
- }
-
- public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
- var maxX:Number = (contentWidth/2)*.8;
- var maxY:Number = (contentHeight/2)*.8;
- var radius:Number = Math.min( maxX, maxY );
-
- return Math.max( radius, 1 );
- }
-
- override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
- var i:int;
- var element:ILayoutElement;
- var elementLayoutPoint:Point;
- var elementAngleInRadians:Number;
- var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
- var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
-
- super.updateDisplayList( contentWidth, contentHeight );
-
- for ( i = 0; i < target.numElements; i++ ) {
- element = target.getElementAt(i);
-
- elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
- elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
-
- //used to be setActualSize()
- element.setLayoutBoundsSize( NaN, NaN );
- var elementWidth:Number = element.getLayoutBoundsWidth()/2;
- var elementHeight:Number = element.getLayoutBoundsHeight()/2;
-
- //Use to be move()
- element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
- //trace( "x:", elementLayoutPoint.x-elementWidth );
- //trace( "y:", elementLayoutPoint.y-elementHeight );
- }
- }
-
- public function CircleLayout() {
- super();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
deleted file mode 100644
index 52022dc..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math
-{
- import flash.geom.Point;
-
- public class Donut extends Circle
- {
- public static const DONUT_RADIUS_RATIO:Number = 0.2;
-
- private var _innerRadius:Number;
-
- public function Donut( origin:Point, radius:Number )
- {
- super( origin, radius );
-
- _innerRadius = radius * DONUT_RADIUS_RATIO;
- }
-
- public function get innerRadius():Number
- {
- return _innerRadius;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
deleted file mode 100644
index 3ce5674..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.components.layout
-{
- import flash.geom.Point;
-
- import mx.core.ILayoutElement;
-
- import net.digitalprimates.math.Circle;
-
- import spark.layouts.supportClasses.LayoutBase;
-
- public class CircleLayout extends LayoutBase {
-
- private var _offset:Number = 0;
-
- public function get offset():Number {
- return _offset;
- }
-
- public function set offset(value:Number):void {
- _offset = value;
- target.invalidateDisplayList();
- }
-
- public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
- var maxX:Number = (contentWidth/2)*.8;
- var maxY:Number = (contentHeight/2)*.8;
- var radius:Number = Math.min( maxX, maxY );
-
- return Math.max( radius, 1 );
- }
-
- override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
- var i:int;
- var element:ILayoutElement;
- var elementLayoutPoint:Point;
- var elementAngleInRadians:Number;
- var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
- var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
-
- super.updateDisplayList( contentWidth, contentHeight );
-
- for ( i = 0; i < target.numElements; i++ ) {
- element = target.getElementAt(i);
-
- elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
- elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
-
- //used to be setActualSize()
- element.setLayoutBoundsSize( NaN, NaN );
- var elementWidth:Number = element.getLayoutBoundsWidth()/2;
- var elementHeight:Number = element.getLayoutBoundsHeight()/2;
-
- //Use to be move()
- element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
- //trace( "x:", elementLayoutPoint.x-elementWidth );
- //trace( "y:", elementLayoutPoint.y-elementHeight );
- }
- }
-
- public function CircleLayout() {
- super();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d8724d9..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
- [Test]
- public function shouldGetEqualRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Radius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function get_Diameter():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function get_origin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function test_equals():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
- var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- assertFalse( circle.equals( circle3 ) );
- assertFalse( circle.equals( circle4 ) );
- }
-
- /*[Test]
- public function test_getPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
- */
- /*[Test]
- public function test_constructor():void {
- var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
- }*/
- }
-}
\ No newline at end of file
[28/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index 2628e75..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
-
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
deleted file mode 100644
index b7a4ec9..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt2</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
deleted file mode 100644
index ab8a7db..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt2/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- import org.flexunit.runner.FlexUnitCore;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[42/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/SampleCircleLayout.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/SampleCircleLayout.mxml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/SampleCircleLayout.mxml
new file mode 100644
index 0000000..d71afcb
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/SampleCircleLayout.mxml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:layout="net.digitalprimates.components.layout.*" minWidth="955" minHeight="600">
+
+ <s:HSlider id="slider" liveDragging="true" stepSize=".1"/>
+ <s:Group width="100%" height="100%">
+ <s:layout>
+ <layout:CircleLayout offset="{slider.value}"/>
+ </s:layout>
+
+ <mx:Image source="assets/1.jpg"/>
+ <mx:Image source="assets/2.jpg"/>
+ <mx:Image source="assets/3.jpg"/>
+ <mx:Image source="assets/4.jpg"/>
+ <mx:Image source="assets/5.jpg"/>
+ </s:Group>
+
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/1.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/1.jpg b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/1.jpg
new file mode 100644
index 0000000..70c6dc7
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/1.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/2.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/2.jpg b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/2.jpg
new file mode 100644
index 0000000..8044a3f
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/2.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/3.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/3.jpg b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/3.jpg
new file mode 100644
index 0000000..6f75776
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/3.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/4.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/4.jpg b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/4.jpg
new file mode 100644
index 0000000..4eb99d5
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/4.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/5.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/5.jpg b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/5.jpg
new file mode 100644
index 0000000..3c03b15
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/assets/5.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
new file mode 100644
index 0000000..3ce5674
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.components.layout
+{
+ import flash.geom.Point;
+
+ import mx.core.ILayoutElement;
+
+ import net.digitalprimates.math.Circle;
+
+ import spark.layouts.supportClasses.LayoutBase;
+
+ public class CircleLayout extends LayoutBase {
+
+ private var _offset:Number = 0;
+
+ public function get offset():Number {
+ return _offset;
+ }
+
+ public function set offset(value:Number):void {
+ _offset = value;
+ target.invalidateDisplayList();
+ }
+
+ public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
+ var maxX:Number = (contentWidth/2)*.8;
+ var maxY:Number = (contentHeight/2)*.8;
+ var radius:Number = Math.min( maxX, maxY );
+
+ return Math.max( radius, 1 );
+ }
+
+ override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
+ var i:int;
+ var element:ILayoutElement;
+ var elementLayoutPoint:Point;
+ var elementAngleInRadians:Number;
+ var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
+ var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
+
+ super.updateDisplayList( contentWidth, contentHeight );
+
+ for ( i = 0; i < target.numElements; i++ ) {
+ element = target.getElementAt(i);
+
+ elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
+ elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
+
+ //used to be setActualSize()
+ element.setLayoutBoundsSize( NaN, NaN );
+ var elementWidth:Number = element.getLayoutBoundsWidth()/2;
+ var elementHeight:Number = element.getLayoutBoundsHeight()/2;
+
+ //Use to be move()
+ element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
+ //trace( "x:", elementLayoutPoint.x-elementWidth );
+ //trace( "y:", elementLayoutPoint.y-elementHeight );
+ }
+ }
+
+ public function CircleLayout() {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
new file mode 100644
index 0000000..52022dc
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math
+{
+ import flash.geom.Point;
+
+ public class Donut extends Circle
+ {
+ public static const DONUT_RADIUS_RATIO:Number = 0.2;
+
+ private var _innerRadius:Number;
+
+ public function Donut( origin:Point, radius:Number )
+ {
+ super( origin, radius );
+
+ _innerRadius = radius * DONUT_RADIUS_RATIO;
+ }
+
+ public function get innerRadius():Number
+ {
+ return _innerRadius;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
new file mode 100644
index 0000000..3ce5674
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/src/net/digitalprimates/math/layout/CircleLayout.as
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.components.layout
+{
+ import flash.geom.Point;
+
+ import mx.core.ILayoutElement;
+
+ import net.digitalprimates.math.Circle;
+
+ import spark.layouts.supportClasses.LayoutBase;
+
+ public class CircleLayout extends LayoutBase {
+
+ private var _offset:Number = 0;
+
+ public function get offset():Number {
+ return _offset;
+ }
+
+ public function set offset(value:Number):void {
+ _offset = value;
+ target.invalidateDisplayList();
+ }
+
+ public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
+ var maxX:Number = (contentWidth/2)*.8;
+ var maxY:Number = (contentHeight/2)*.8;
+ var radius:Number = Math.min( maxX, maxY );
+
+ return Math.max( radius, 1 );
+ }
+
+ override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
+ var i:int;
+ var element:ILayoutElement;
+ var elementLayoutPoint:Point;
+ var elementAngleInRadians:Number;
+ var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
+ var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
+
+ super.updateDisplayList( contentWidth, contentHeight );
+
+ for ( i = 0; i < target.numElements; i++ ) {
+ element = target.getElementAt(i);
+
+ elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
+ elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
+
+ //used to be setActualSize()
+ element.setLayoutBoundsSize( NaN, NaN );
+ var elementWidth:Number = element.getLayoutBoundsWidth()/2;
+ var elementHeight:Number = element.getLayoutBoundsHeight()/2;
+
+ //Use to be move()
+ element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
+ //trace( "x:", elementLayoutPoint.x-elementWidth );
+ //trace( "y:", elementLayoutPoint.y-elementHeight );
+ }
+ }
+
+ public function CircleLayout() {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d8724d9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+ [Test]
+ public function shouldGetEqualRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Radius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Diameter():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function get_origin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function test_equals():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
+ var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ assertFalse( circle.equals( circle3 ) );
+ assertFalse( circle.equals( circle4 ) );
+ }
+
+ /*[Test]
+ public function test_getPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+ */
+ /*[Test]
+ public function test_constructor():void {
+ var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+ }*/
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
deleted file mode 100644
index b9587a7..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
deleted file mode 100644
index f6e02ba..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/build.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This build file is intended as a simple example for FlexUnit4Training.
-
- The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
- for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
- -->
-<project name="FlexUnit4SampleProject" basedir="." default="package">
- <!-- setup a prefix for all environment variables -->
- <property environment="env" />
-
- <!-- Setup paths for build -->
- <property name="main.src.loc" location="${basedir}/src/" />
- <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
- <property name="lib.loc" location="${basedir}/libs" />
- <property name="output.loc" location="${basedir}/target" />
- <property name="bin.loc" location="${output.loc}/bin" />
- <property name="report.loc" location="${output.loc}/report" />
- <property name="dist.loc" location="${output.loc}/dist" />
-
- <!-- Setup Flex and FlexUnit ant tasks -->
- <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
- <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
- <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
-
- <target name="clean">
- <!-- Remove all directories created during the build process -->
- <delete dir="${output.loc}" />
- </target>
-
- <target name="init">
- <!-- Create directories needed for the build process -->
- <mkdir dir="${output.loc}" />
- <mkdir dir="${bin.loc}" />
- <mkdir dir="${report.loc}" />
- <mkdir dir="${dist.loc}" />
- </target>
-
- <target name="compile" depends="init">
- <!-- Compile Main.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
- </target>
-
- <target name="test" depends="init">
- <!-- Compile TestRunner.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
- <source-path path-element="${main.src.loc}" />
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
-
- <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
- <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
- toDir="${report.loc}"
- haltonfailure="false"
- verbose="true"
- localTrusted="true" />
-
- <!-- Generate readable JUnit-style reports -->
- <junitreport todir="${report.loc}">
- <fileset dir="${report.loc}">
- <include name="TEST-*.xml" />
- </fileset>
- <report format="frames" todir="${report.loc}/html" />
- </junitreport>
- </target>
-
- <target name="package" depends="test">
- <!-- Assemble final website -->
- <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
- <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
-
- <!-- Zip up final website -->
- <zip destfile="${output.loc}/${ant.project.name}.zip">
- <fileset dir="${dist.loc}" />
- </zip>
- </target>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
[16/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f547c33..0000000
--- a/FlexUnit4Tutorials/Unit2/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit2/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
[22/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
rename folder
Posted by jm...@apache.org.
rename folder
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/64592fdd
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/64592fdd
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/64592fdd
Branch: refs/heads/develop
Commit: 64592fdd697a43c472f7c379214a0b53537beab7
Parents: d5fae11
Author: cyrillzadra <cy...@gmail.com>
Authored: Sun Sep 1 20:57:37 2013 +0800
Committer: cyrillzadra <cy...@gmail.com>
Committed: Sun Sep 1 20:57:37 2013 +0800
----------------------------------------------------------------------
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../complete/FlexUnit4Training/.flexProperties | 18 -
.../complete/FlexUnit4Training/.fxpProperties | 32 -
.../Unit1/complete/FlexUnit4Training/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../Unit1/complete/FlexUnit4Training/build.xml | 104 ---
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../src/net/digitalprimates/math/Donut.as | 40 -
.../tests/math/testcases/BasicCircleTest.as | 85 --
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../completex/FlexUnit4Training/.flexProperties | 18 +
.../completex/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/completex/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/completex/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../start/FlexUnit4Training/.flexProperties | 18 -
.../start/FlexUnit4Training/.fxpProperties | 32 -
.../Unit1/start/FlexUnit4Training/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../Unit1/start/FlexUnit4Training/build.xml | 104 ---
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/SampleCircleLayout.mxml | 35 -
.../start/FlexUnit4Training/src/assets/1.jpg | Bin 16146 -> 0 bytes
.../start/FlexUnit4Training/src/assets/2.jpg | Bin 13636 -> 0 bytes
.../start/FlexUnit4Training/src/assets/3.jpg | Bin 9528 -> 0 bytes
.../start/FlexUnit4Training/src/assets/4.jpg | Bin 11967 -> 0 bytes
.../start/FlexUnit4Training/src/assets/5.jpg | Bin 11536 -> 0 bytes
.../components/layout/CircleLayout.as | 80 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../src/net/digitalprimates/math/Donut.as | 40 -
.../digitalprimates/math/layout/CircleLayout.as | 80 --
.../tests/math/testcases/BasicCircleTest.as | 85 --
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../startx/FlexUnit4Training/.flexProperties | 18 +
.../startx/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/startx/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/startx/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/SampleCircleLayout.mxml | 35 +
.../startx/FlexUnit4Training/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../startx/FlexUnit4Training/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../startx/FlexUnit4Training/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../startx/FlexUnit4Training/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../startx/FlexUnit4Training/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../digitalprimates/math/layout/CircleLayout.as | 80 ++
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../FlexUnit4Training_wt1/.fxpProperties | 32 -
.../complete/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 33 -
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../completex/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../start/FlexUnit4Training_wt1/.flexProperties | 18 -
.../start/FlexUnit4Training_wt1/.fxpProperties | 32 -
.../Unit2/start/FlexUnit4Training_wt1/.project | 34 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 48 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 22 -
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../startx/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit2/startx/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 22 +
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt1/.flexProperties | 18 -
.../FlexUnit4Training_wt1/.fxpProperties | 32 -
.../complete/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 84 --
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt2/.flexProperties | 18 -
.../FlexUnit4Training_wt2/.fxpProperties | 32 -
.../complete/FlexUnit4Training_wt2/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 50 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 94 ---
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../FlexUnit4Training_wt3/.flexProperties | 18 -
.../FlexUnit4Training_wt3/.fxpProperties | 32 -
.../complete/FlexUnit4Training_wt3/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 114 ---
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../completex/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../completex/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../completex/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../start/FlexUnit4Training_wt1/.flexProperties | 18 -
.../start/FlexUnit4Training_wt1/.fxpProperties | 32 -
.../Unit4/start/FlexUnit4Training_wt1/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 33 -
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../start/FlexUnit4Training_wt2/.flexProperties | 18 -
.../start/FlexUnit4Training_wt2/.fxpProperties | 32 -
.../Unit4/start/FlexUnit4Training_wt2/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../src/FlexUnit4Training.mxml | 45 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 84 --
.../FlexUnitApplicationLastRun.xml | 22 -
.../FlexUnitApplicationLastSelection.xml | 22 -
.../start/FlexUnit4Training_wt3/.flexProperties | 18 -
.../start/FlexUnit4Training_wt3/.fxpProperties | 32 -
.../Unit4/start/FlexUnit4Training_wt3/.project | 35 -
.../.settings/org.eclipse.core.resources.prefs | 18 -
.../html-template/history/history.css | 22 -
.../html-template/history/history.js | 726 -----------------
.../html-template/history/historyFrame.html | 45 --
.../html-template/index.template.html | 121 ---
.../html-template/playerProductInstall.swf | Bin 657 -> 0 bytes
.../html-template/swfobject.js | 793 -------------------
.../libs/flexUnitTasks-4.1.0.jar | Bin 592892 -> 0 bytes
.../src/FlexUnit4Training.mxml | 50 --
.../src/net/digitalprimates/math/Circle.as | 131 ---
.../tests/math/testcases/BasicCircleTest.as | 94 ---
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../startx/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit4/startx/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../startx/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit4/startx/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../startx/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit4/startx/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
326 files changed, 21529 insertions(+), 21529 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.project
deleted file mode 100644
index b9587a7..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/build.xml
deleted file mode 100644
index f6e02ba..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/build.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This build file is intended as a simple example for FlexUnit4Training.
-
- The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
- for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
- -->
-<project name="FlexUnit4SampleProject" basedir="." default="package">
- <!-- setup a prefix for all environment variables -->
- <property environment="env" />
-
- <!-- Setup paths for build -->
- <property name="main.src.loc" location="${basedir}/src/" />
- <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
- <property name="lib.loc" location="${basedir}/libs" />
- <property name="output.loc" location="${basedir}/target" />
- <property name="bin.loc" location="${output.loc}/bin" />
- <property name="report.loc" location="${output.loc}/report" />
- <property name="dist.loc" location="${output.loc}/dist" />
-
- <!-- Setup Flex and FlexUnit ant tasks -->
- <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
- <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
- <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
-
- <target name="clean">
- <!-- Remove all directories created during the build process -->
- <delete dir="${output.loc}" />
- </target>
-
- <target name="init">
- <!-- Create directories needed for the build process -->
- <mkdir dir="${output.loc}" />
- <mkdir dir="${bin.loc}" />
- <mkdir dir="${report.loc}" />
- <mkdir dir="${dist.loc}" />
- </target>
-
- <target name="compile" depends="init">
- <!-- Compile Main.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
- </target>
-
- <target name="test" depends="init">
- <!-- Compile TestRunner.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
- <source-path path-element="${main.src.loc}" />
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
-
- <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
- <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
- toDir="${report.loc}"
- haltonfailure="false"
- verbose="true"
- localTrusted="true" />
-
- <!-- Generate readable JUnit-style reports -->
- <junitreport todir="${report.loc}">
- <fileset dir="${report.loc}">
- <include name="TEST-*.xml" />
- </fileset>
- <report format="frames" todir="${report.loc}/html" />
- </junitreport>
- </target>
-
- <target name="package" depends="test">
- <!-- Assemble final website -->
- <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
- <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
-
- <!-- Zip up final website -->
- <zip destfile="${output.loc}/${ant.project.name}.zip">
- <fileset dir="${dist.loc}" />
- </zip>
- </target>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit1/complete/FlexUnit4Training/html-template/playerProductInstall.swf and /dev/null differ
[12/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index 2628e75..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
-
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.project
deleted file mode 100644
index b7a4ec9..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt2</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt2/html-template/playerProductInstall.swf and /dev/null differ
[50/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
Merge branch 'develop' of
https://git-wip-us.apache.org/repos/asf/flex-flexunit into develop
Posted by jm...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-flexunit into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/360e3825
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/360e3825
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/360e3825
Branch: refs/heads/develop
Commit: 360e382574435fb553da5644d8a2186652f256c7
Parents: ce6e3ff fede275
Author: Justin Mclean <jm...@apache.org>
Authored: Sun Mar 16 11:59:08 2014 +1100
Committer: Justin Mclean <jm...@apache.org>
Committed: Sun Mar 16 11:59:08 2014 +1100
----------------------------------------------------------------------
.../tasks/configuration/TaskConfiguration.java | 49 +++++++++++++-------
1 file changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[10/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d706f81..0000000
--- a/FlexUnit4Tutorials/Unit4/complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetTopPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( 0 );
-
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldGetBottomPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( Math.PI );
-
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldGetRightPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( Math.PI/2 );
-
- assertEquals( 0, point.x );
- assertEquals( 5, point.y );
- }
-
- [Test]
- public function shouldGetLeftPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
-
- assertEquals( 0, point.x );
- assertEquals( -5, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
[48/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
added README and ant file (downloads.xml) for thirdparty libraries
Posted by jm...@apache.org.
added README and ant file (downloads.xml) for thirdparty libraries
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/e381d6ba
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/e381d6ba
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/e381d6ba
Branch: refs/heads/develop
Commit: e381d6bae7892f13eeb9fcac08a341c1044c1c05
Parents: 9b92b2f
Author: cyrillzadra <cy...@gmail.com>
Authored: Mon Sep 16 22:50:53 2013 +0200
Committer: cyrillzadra <cy...@gmail.com>
Committed: Mon Sep 16 22:50:53 2013 +0200
----------------------------------------------------------------------
FlexUnit4Tutorials/README | 50 ++++
.../Unit1/Start/FlexUnit4Training/.gitignore | 3 +
.../Unit1/Start/FlexUnit4Training/downloads.xml | 294 +++++++++++++++++++
3 files changed, 347 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/e381d6ba/FlexUnit4Tutorials/README
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/README b/FlexUnit4Tutorials/README
new file mode 100644
index 0000000..ea4074c
--- /dev/null
+++ b/FlexUnit4Tutorials/README
@@ -0,0 +1,50 @@
+Install Prerequisites
+---------------------
+
+ Before using FlexUnit tutorials you must install the following software and set the
+ corresponding environment variables using absolute file paths. Relative file paths
+ will result in build errors.
+
+ ==================================================================================
+ SOFTWARE ENVIRONMENT VARIABLE (absolute paths)
+ ==================================================================================
+
+ Java SDK 1.6 or greater (*1) JAVA_HOME
+ (for Java 1.7 see note at (*2))
+
+ Ant 1.7.1 or greater (*1) ANT_HOME
+ (for Java 1.7 see note at (*2))
+
+ Apache Flex (*3) FLEX_HOME
+
+ ==================================================================================
+
+ *1) The bin directories for ANT_HOME and JAVA_HOME should be added to your PATH.
+
+ On Windows, set PATH to
+
+ PATH=%PATH%;%ANT_HOME%\bin;%JAVA_HOME%\bin
+
+ On the Mac (bash), set PATH to
+
+ export PATH="$PATH:$ANT_HOME/bin:$JAVA_HOME/bin"
+
+ On Linux make sure you path include ANT_HOME and JAVA_HOME.
+
+ *2) If you are using Java SDK 1.7 or greater on a Mac you must use Ant 1.8 or
+ greater. If you use Java 1.7 with Ant 1.7, ant reports the java version as 1.6
+ so the JVM args for the data model (-d32/-d64) will not be set correctly and
+ you will get compile errors.
+
+ *3) FLEX_HOME should be set to a valid Apache Flex installation.
+
+
+Software Dependencies
+---------------------
+
+ When you have all the prerequisites in place and the environment variables set,
+ (see Install Prerequisites above), use
+
+ ant -f downloads.xml
+
+ in each tutorial project.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/e381d6ba/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.gitignore
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.gitignore b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.gitignore
new file mode 100644
index 0000000..b5a307a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.gitignore
@@ -0,0 +1,3 @@
+/in/
+/libs/
+/bin-debug/
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/e381d6ba/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/downloads.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/downloads.xml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/downloads.xml
new file mode 100644
index 0000000..c2b0bf9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/downloads.xml
@@ -0,0 +1,294 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<project name="downloads" default="main" basedir=".">
+
+ <pathconvert property="compiler.tests" dirsep="/">
+ <path location="${basedir}"/>
+ </pathconvert>
+
+ <property name="lib.dir" value="${compiler.tests}/libs"/>
+
+ <property name="download.dir" value="${compiler.tests}/in"/>
+
+ <!--
+ Notes:
+ For Apache, the SWCs must be removed from the repository.
+
+ Licenses:
+ asx.swc - MIT
+ flexunit-core-flex - Apache 2.0
+ floxy - BDY
+ hamcrest (1.1.3) - BSD
+ mockolate (0.9.3) - MIT
+ -->
+
+ <!--
+ Because the downloads requires a network connection and the JARs don't change very often,
+ they are each downloaded only if they don't already exist.
+ -->
+
+ <target name="main" depends="prepare, asx-swc, flexunit-core-flex-swc, floxy-swc, hamcrest-swc, mockolate-swc"
+ description="Downloads all the required thirdparty SWCs"/>
+
+ <target name="prepare" >
+ <mkdir dir="${lib.dir}" />
+ </target>
+
+ <!--
+ Cleanup
+ -->
+
+ <target name="clean"
+ description="Removes thirdparty downloads.">
+ <delete includeEmptyDirs="true" failonerror="false">
+ <fileset dir="${lib.dir}" />
+ <fileset dir="${download.dir}" />
+ </delete>
+ </target>
+
+ <!--
+ Download thirdparty SWCs
+ -->
+
+ <!--
+ Download a swc file and optionally verify the checksum.
+ If the checksum fails, this script fails.
+
+ Params are:
+ srcUrl
+ srcSwcFile
+ destSwcFile
+ [md5]
+ -->
+ <target name="download-swc"
+ description="Downloads swc, and optionally verifies checksum.">
+ <get src="${srcUrl}/${srcSwcFile}" dest="${destSwcFile}"/>
+ <checksum file="${destSwcFile}" algorithm="MD5" property="${we.failed}"/>
+ <antcall target="fail-with-message">
+ <param name="message" value="Checksum mismatch for ${destSwcFile}"/>
+ </antcall>
+ </target>
+
+ <!--
+ Download a zip or gz file, extracts the jar file, and optionally copies the jar
+ file to a different location and optinally verifies the checksum.
+ If the checksum fails, this script fails.
+
+ Params are:
+ srcUrl
+ zipFile - a .gz file for untar with gzip, else unzip
+ [md5]
+ [srcJarPath] - both src and dest required for the copy
+ [destJarFile]
+
+ Note: This is purposely coded without <if><else><then> so that a dependency on
+ ant-contrib.jar isn't required.
+ -->
+
+ <target name="download-zip"
+ description="Downloads tar/zip, and optionally verifies checksum and copies extracted swc.">
+
+ <mkdir dir="${download.dir}"/>
+
+ <get src="${srcUrl}/${zipFile}" dest="${download.dir}/${zipFile}"/>
+
+ <condition property="zip.compressed">
+ <matches string="${zipFile}" pattern="^*.zip$"/>
+ </condition>
+
+ <antcall target="untar-file"/>
+ <antcall target="unzip-file"/>
+
+ <antcall target="check-sum">
+ <param name="message" value="Checksum mismatch for ${download.dir}/${zipFile}"/>
+ </antcall>
+
+ <condition property="destination.known">
+ <and>
+ <isset property="srcJarPath"/>
+ <isset property="destJarFile"/>
+ </and>
+ </condition>
+ <antcall target="copy-downloaded-swc"/>
+ </target>
+
+ <target name="untar-file" unless="zip.compressed" description="Untars zipFile">
+ <untar src="${download.dir}/${zipFile}" dest="${download.dir}/temp" compression="gzip"/>
+ </target>
+
+ <target name="unzip-file" if="zip.compressed" description="Unzips zipFile">
+ <unzip src="${download.dir}/${zipFile}" dest="${download.dir}/temp"/>
+ </target>
+
+ <target name="check-sum" if="md5"
+ description="Verifies MD5 checksum, and fails if checksum doesn't match">
+
+ <checksum file="${download.dir}/${zipFile}" algorithm="MD5" property="${we.failed}"/>
+ <antcall target="fail-with-message">
+ <param name="message" value="${message}"/>
+ </antcall>
+ </target>
+
+ <target name="copy-downloaded-swc" if="destination.known">
+ <mkdir dir="${lib.dir}"/>
+ <copy file="${download.dir}/temp/${srcJarPath}" toFile="${destJarFile}" verbose="true"/>
+ </target>
+
+ <target name="fail-with-message" if="we.failed"
+ description="Conditionally fails with the specified message">
+ <fail message="${message}"/>
+ </target>
+
+ <!--
+ asx
+ -->
+
+ <target name="asx-swc" depends="asx-swc-check"
+ unless="asx.swc.exists"
+ description="Downloads and copies hamcrest to the lib directory.">
+ <echo message="Obtaining lib/asx.swc"/>
+ <antcall target="download-swc">
+ <param name="srcUrl" value="https://github.com/drewbourne/mockolate/raw/master/mockolate/libs/"/>
+ <param name="srcSwcFile" value="asx.swc"/>
+ <param name="destSwcFile" value="${lib.dir}/asx.swc"/>
+ </antcall>
+
+ <!-- Get license file -->
+ <get src="https://raw.github.com/drewbourne/asx/master/LICENSE" dest="${lib.dir}/asx-LICENSE"/>
+ </target>
+
+ <target name="asx-swc-check" description="Checks if hamcrest swc exists.">
+ <condition property="asx.swc.exists">
+ <and>
+ <available file="${lib.dir}/asx.swc"/>
+ </and>
+ </condition>
+ </target>
+
+ <!--
+ flexunit-core-flex
+ -->
+
+ <target name="flexunit-core-flex-swc" depends="flexunit-core-flex-swc-check"
+ unless="flexunit.core.flex.swc.exists"
+ description="Downloads and copies hamcrest to the lib directory.">
+ <echo message="Obtaining lib/hamcrest-as3-flex-1.1.3.swc"/>
+ <antcall target="download-swc">
+ <param name="srcUrl" value="https://builds.apache.org/job/flex-flexunit/lastSuccessfulBuild/artifact/FlexUnit4/target/"/>
+ <param name="srcSwcFile" value="flexunit-4.1.0-x-flex_y.y.y.y.swc"/>
+ <param name="destSwcFile" value="${lib.dir}/flexunit-core-flex.swc"/>
+ </antcall>
+
+ <!-- Get license file -->
+ <get src="https://git-wip-us.apache.org/repos/asf?p=flex-flexunit.git;a=blob_plain;f=LICENSE;hb=refs/heads/develop" dest="${lib.dir}/flexunit-core-flex-LICENSE"/>
+ </target>
+
+ <target name="flexunit-core-flex-swc-check" description="Checks if hamcrest swc exists.">
+ <condition property="flexunit.core.flex.swc.exists">
+ <and>
+ <available file="${lib.dir}/flexunit-core-flex.swc"/>
+ </and>
+ </condition>
+ </target>
+
+ <!--
+ floxy
+ -->
+
+ <target name="floxy-swc" depends="floxy-swc-check"
+ unless="floxy.swc.exists"
+ description="Downloads and copies hamcrest to the lib directory.">
+ <echo message="Obtaining lib/floxy.swc"/>
+ <antcall target="download-swc">
+ <param name="srcUrl" value="https://github.com/drewbourne/mockolate/raw/master/mockolate/libs/"/>
+ <param name="srcSwcFile" value="FLoxy.swc"/>
+ <param name="destSwcFile" value="${lib.dir}/floxy.swc"/>
+ </antcall>
+
+ <!-- Get license file -->
+ <get src="https://floxy.googlecode.com/svn/trunk/LICENSE.txt" dest="${lib.dir}/floxy-LICENSE"/>
+ </target>
+
+ <target name="floxy-swc-check" description="Checks if hamcrest swc exists.">
+ <condition property="floxy.swc.exists">
+ <and>
+ <available file="${lib.dir}/floxy.swc"/>
+ </and>
+ </condition>
+ </target>
+
+ <!--
+ hamcrest-as3
+ -->
+ <target name="hamcrest-swc" depends="hamcrest-swc-check"
+ unless="hamcrest.swc.exists"
+ description="Downloads and copies hamcrest to the lib directory.">
+ <echo message="Obtaining lib/hamcrest-as3-flex-1.1.3.swc"/>
+ <antcall target="download-zip">
+ <param name="srcUrl" value="http://cloud.github.com/downloads/drewbourne/hamcrest-as3"/>
+ <param name="zipFile" value="hamcrest-as3-flex-1.1.3.zip"/>
+ <param name="srcJarPath" value="hamcrest-as3-flex-1.1.3/hamcrest-as3-flex-1.1.3.swc"/>
+ <param name="md5" value="b73fe1bb5f443993adcf8b274f6a48b2"/>
+ <param name="destJarFile" value="${lib.dir}/hamcrest-as3-flex-1.1.3.swc"/>
+ </antcall>
+ <delete dir="${download.dir}/temp/hamcrest-as3-flex-1.1.3"/>
+
+ <!-- Get license file -->
+ <get src="https://raw.github.com/drewbourne/hamcrest-as3/master/hamcrest/LICENSE" dest="${lib.dir}/hamcrest-LICENSE"/>
+ </target>
+
+ <target name="hamcrest-swc-check" description="Checks if hamcrest swc exists.">
+ <condition property="hamcrest.swc.exists">
+ <and>
+ <available file="${lib.dir}/hamcrest-as3-flex-1.1.3.swc"/>
+ </and>
+ </condition>
+ </target>
+
+ <!--
+ mockolate
+ -->
+ <target name="mockolate-swc-check" description="Checks if mockolate swc exists.">
+ <condition property="mockolate.swc.exists">
+ <and>
+ <available file="${lib.dir}/mockolate-0.9.5.swc"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="mockolate-swc" depends="mockolate-swc-check"
+ unless="mockolate.swc.exists"
+ description="Downloads and copies mockolate to the lib directory.">
+ <echo message="Obtaining lib/mockolate-0.9.5.swc"/>
+ <antcall target="download-zip">
+ <param name="srcUrl" value="http://cloud.github.com/downloads/drewbourne/mockolate"/>
+ <param name="zipFile" value="mockolate-0.9.5.zip"/>
+ <param name="srcJarPath" value="mockolate-0.9.5/mockolate-0.9.5.swc"/>
+ <param name="md5" value="b73fe1bb5f443993adcf8b274f6a48b2"/>
+ <param name="destJarFile" value="${lib.dir}/mockolate-0.9.5.swc"/>
+ </antcall>
+ <delete dir="${download.dir}/temp/mockolate-0.9.5"/>
+
+ <!-- Get license file -->
+ <get src="https://raw.github.com/drewbourne/mockolate/master/LICENSE" dest="${lib.dir}/mockolate-LICENSE"/>
+ </target>
+
+</project>
[26/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index d706f81..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetTopPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( 0 );
-
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldGetBottomPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( Math.PI );
-
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldGetRightPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( Math.PI/2 );
-
- assertEquals( 0, point.x );
- assertEquals( 5, point.y );
- }
-
- [Test]
- public function shouldGetLeftPointOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
-
- assertEquals( 0, point.x );
- assertEquals( -5, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
[06/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f547c33..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.flexProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.fxpProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.project b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.project
deleted file mode 100644
index b7a4ec9..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt2</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt2/html-template/playerProductInstall.swf and /dev/null differ
[40/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
deleted file mode 100644
index f6e02ba..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/build.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This build file is intended as a simple example for FlexUnit4Training.
-
- The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
- for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
- -->
-<project name="FlexUnit4SampleProject" basedir="." default="package">
- <!-- setup a prefix for all environment variables -->
- <property environment="env" />
-
- <!-- Setup paths for build -->
- <property name="main.src.loc" location="${basedir}/src/" />
- <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
- <property name="lib.loc" location="${basedir}/libs" />
- <property name="output.loc" location="${basedir}/target" />
- <property name="bin.loc" location="${output.loc}/bin" />
- <property name="report.loc" location="${output.loc}/report" />
- <property name="dist.loc" location="${output.loc}/dist" />
-
- <!-- Setup Flex and FlexUnit ant tasks -->
- <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
- <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
- <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
-
- <target name="clean">
- <!-- Remove all directories created during the build process -->
- <delete dir="${output.loc}" />
- </target>
-
- <target name="init">
- <!-- Create directories needed for the build process -->
- <mkdir dir="${output.loc}" />
- <mkdir dir="${bin.loc}" />
- <mkdir dir="${report.loc}" />
- <mkdir dir="${dist.loc}" />
- </target>
-
- <target name="compile" depends="init">
- <!-- Compile Main.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
- </target>
-
- <target name="test" depends="init">
- <!-- Compile TestRunner.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
- <source-path path-element="${main.src.loc}" />
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
-
- <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
- <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
- toDir="${report.loc}"
- haltonfailure="false"
- verbose="true"
- localTrusted="true" />
-
- <!-- Generate readable JUnit-style reports -->
- <junitreport todir="${report.loc}">
- <fileset dir="${report.loc}">
- <include name="TEST-*.xml" />
- </fileset>
- <report format="frames" todir="${report.loc}/html" />
- </junitreport>
- </target>
-
- <target name="package" depends="test">
- <!-- Assemble final website -->
- <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
- <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
-
- <!-- Zip up final website -->
- <zip destfile="${output.loc}/${ant.project.name}.zip">
- <fileset dir="${dist.loc}" />
- </zip>
- </target>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
deleted file mode 100644
index d71afcb..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/SampleCircleLayout.mxml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:layout="net.digitalprimates.components.layout.*" minWidth="955" minHeight="600">
-
- <s:HSlider id="slider" liveDragging="true" stepSize=".1"/>
- <s:Group width="100%" height="100%">
- <s:layout>
- <layout:CircleLayout offset="{slider.value}"/>
- </s:layout>
-
- <mx:Image source="assets/1.jpg"/>
- <mx:Image source="assets/2.jpg"/>
- <mx:Image source="assets/3.jpg"/>
- <mx:Image source="assets/4.jpg"/>
- <mx:Image source="assets/5.jpg"/>
- </s:Group>
-
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg
deleted file mode 100644
index 70c6dc7..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/1.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg
deleted file mode 100644
index 8044a3f..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/2.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg
deleted file mode 100644
index 6f75776..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/3.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg
deleted file mode 100644
index 4eb99d5..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/4.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg
deleted file mode 100644
index 3c03b15..0000000
Binary files a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/assets/5.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
deleted file mode 100644
index 3ce5674..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/components/layout/CircleLayout.as
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.components.layout
-{
- import flash.geom.Point;
-
- import mx.core.ILayoutElement;
-
- import net.digitalprimates.math.Circle;
-
- import spark.layouts.supportClasses.LayoutBase;
-
- public class CircleLayout extends LayoutBase {
-
- private var _offset:Number = 0;
-
- public function get offset():Number {
- return _offset;
- }
-
- public function set offset(value:Number):void {
- _offset = value;
- target.invalidateDisplayList();
- }
-
- public function getLayoutRadius( contentWidth:Number, contentHeight:Number ):Number {
- var maxX:Number = (contentWidth/2)*.8;
- var maxY:Number = (contentHeight/2)*.8;
- var radius:Number = Math.min( maxX, maxY );
-
- return Math.max( radius, 1 );
- }
-
- override public function updateDisplayList( contentWidth:Number, contentHeight:Number ):void {
- var i:int;
- var element:ILayoutElement;
- var elementLayoutPoint:Point;
- var elementAngleInRadians:Number;
- var radiansBetweenElements:Number = ( Circle.RADIANS_PER_CIRCLE ) / target.numElements;
- var circle:Circle = new Circle( new Point( contentWidth/2, contentHeight/2 ), getLayoutRadius( contentWidth, contentHeight ) );
-
- super.updateDisplayList( contentWidth, contentHeight );
-
- for ( i = 0; i < target.numElements; i++ ) {
- element = target.getElementAt(i);
-
- elementAngleInRadians = ( i * radiansBetweenElements ) - offset;
- elementLayoutPoint = circle.getPointOnCircle( elementAngleInRadians );
-
- //used to be setActualSize()
- element.setLayoutBoundsSize( NaN, NaN );
- var elementWidth:Number = element.getLayoutBoundsWidth()/2;
- var elementHeight:Number = element.getLayoutBoundsHeight()/2;
-
- //Use to be move()
- element.setLayoutBoundsPosition( elementLayoutPoint.x-elementWidth, elementLayoutPoint.y-elementHeight );
- //trace( "x:", elementLayoutPoint.x-elementWidth );
- //trace( "y:", elementLayoutPoint.y-elementHeight );
- }
- }
-
- public function CircleLayout() {
- super();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
deleted file mode 100644
index 52022dc..0000000
--- a/FlexUnit4Tutorials/Unit1/startx/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math
-{
- import flash.geom.Point;
-
- public class Donut extends Circle
- {
- public static const DONUT_RADIUS_RATIO:Number = 0.2;
-
- private var _innerRadius:Number;
-
- public function Donut( origin:Point, radius:Number )
- {
- super( origin, radius );
-
- _innerRadius = radius * DONUT_RADIUS_RATIO;
- }
-
- public function get innerRadius():Number
- {
- return _innerRadius;
- }
-
- }
-}
\ No newline at end of file
[32/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d706f81
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetTopPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( 0 );
+
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldGetBottomPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( Math.PI );
+
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldGetRightPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( Math.PI/2 );
+
+ assertEquals( 0, point.x );
+ assertEquals( 5, point.y );
+ }
+
+ [Test]
+ public function shouldGetLeftPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
+
+ assertEquals( 0, point.x );
+ assertEquals( -5, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..711e3b9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[14/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index bccbb82..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f130618..0000000
--- a/FlexUnit4Tutorials/Unit2/start/FlexUnit4Training_wt1/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
-
- public class BasicCircleTest {
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
new file mode 100644
index 0000000..893d0e2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit2/startx/FlexUnit4Training_wt1/html-template/playerProductInstall.swf differ
[20/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
new file mode 100644
index 0000000..52022dc
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math
+{
+ import flash.geom.Point;
+
+ public class Donut extends Circle
+ {
+ public static const DONUT_RADIUS_RATIO:Number = 0.2;
+
+ private var _innerRadius:Number;
+
+ public function Donut( origin:Point, radius:Number )
+ {
+ super( origin, radius );
+
+ _innerRadius = radius * DONUT_RADIUS_RATIO;
+ }
+
+ public function get innerRadius():Number
+ {
+ return _innerRadius;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d8724d9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/completex/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+ [Test]
+ public function shouldGetEqualRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Radius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Diameter():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function get_origin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function test_equals():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
+ var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ assertFalse( circle.equals( circle3 ) );
+ assertFalse( circle.equals( circle4 ) );
+ }
+
+ /*[Test]
+ public function test_getPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+ */
+ /*[Test]
+ public function test_constructor():void {
+ var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+ }*/
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.fxpProperties
deleted file mode 100644
index 85b29aa..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.project
deleted file mode 100644
index b9587a7..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/build.xml
deleted file mode 100644
index f6e02ba..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/build.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This build file is intended as a simple example for FlexUnit4Training.
-
- The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
- for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
- -->
-<project name="FlexUnit4SampleProject" basedir="." default="package">
- <!-- setup a prefix for all environment variables -->
- <property environment="env" />
-
- <!-- Setup paths for build -->
- <property name="main.src.loc" location="${basedir}/src/" />
- <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
- <property name="lib.loc" location="${basedir}/libs" />
- <property name="output.loc" location="${basedir}/target" />
- <property name="bin.loc" location="${output.loc}/bin" />
- <property name="report.loc" location="${output.loc}/report" />
- <property name="dist.loc" location="${output.loc}/dist" />
-
- <!-- Setup Flex and FlexUnit ant tasks -->
- <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
- <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
- <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
-
- <target name="clean">
- <!-- Remove all directories created during the build process -->
- <delete dir="${output.loc}" />
- </target>
-
- <target name="init">
- <!-- Create directories needed for the build process -->
- <mkdir dir="${output.loc}" />
- <mkdir dir="${bin.loc}" />
- <mkdir dir="${report.loc}" />
- <mkdir dir="${dist.loc}" />
- </target>
-
- <target name="compile" depends="init">
- <!-- Compile Main.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
- </target>
-
- <target name="test" depends="init">
- <!-- Compile TestRunner.mxml as a SWF -->
- <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
- <source-path path-element="${main.src.loc}" />
- <library-path dir="${lib.loc}" append="true">
- <include name="*.swc" />
- </library-path>
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
- <compiler.headless-server>true</compiler.headless-server>
- </mxmlc>
-
- <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
- <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
- toDir="${report.loc}"
- haltonfailure="false"
- verbose="true"
- localTrusted="true" />
-
- <!-- Generate readable JUnit-style reports -->
- <junitreport todir="${report.loc}">
- <fileset dir="${report.loc}">
- <include name="TEST-*.xml" />
- </fileset>
- <report format="frames" todir="${report.loc}/html" />
- </junitreport>
- </target>
-
- <target name="package" depends="test">
- <!-- Assemble final website -->
- <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
- <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
-
- <!-- Zip up final website -->
- <zip destfile="${output.loc}/${ant.project.name}.zip">
- <fileset dir="${dist.loc}" />
- </zip>
- </target>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit1/start/FlexUnit4Training/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
[23/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index f85bf23..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var point:Point;
-
- //top-most point of circle
- point = circle.getPointOnCircle( 0 );
- assertEquals( 5, point.x );
- assertEquals( 0, point.y );
-
- //bottom-most point of circle
- point = circle.getPointOnCircle( Math.PI );
- assertEquals( -5, point.x );
- assertEquals( 0, point.y );
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
Re: [01/50] [abbrv] rename folder
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
FlexUnit4Training is not included in either the release or source branches so it's not an issue as far as a release goes.
Justin
Re: [01/50] [abbrv] rename folder
Posted by Alex Harui <ah...@adobe.com>.
SWFObject probably shouldn't be in the repo.
On 3/15/14 6:00 PM, "jmclean@apache.org" <jm...@apache.org> wrote:
>Repository: flex-flexunit
>Updated Branches:
> refs/heads/develop fede2751f -> 360e38257
>
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>new file mode 100644
>index 0000000..c862aae
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>@@ -0,0 +1,793 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
>+ is released under the MIT License
><http://www.opensource.org/licenses/mit-license.php>
>+*/
>+
>+var swfobject = function() {
>+
>+ var UNDEF = "undefined",
>+ OBJECT = "object",
>+ SHOCKWAVE_FLASH = "Shockwave Flash",
>+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
>+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
>+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
>+ ON_READY_STATE_CHANGE = "onreadystatechange",
>+
>+ win = window,
>+ doc = document,
>+ nav = navigator,
>+
>+ plugin = false,
>+ domLoadFnArr = [main],
>+ regObjArr = [],
>+ objIdArr = [],
>+ listenersArr = [],
>+ storedAltContent,
>+ storedAltContentId,
>+ storedCallbackFn,
>+ storedCallbackObj,
>+ isDomLoaded = false,
>+ isExpressInstallActive = false,
>+ dynamicStylesheet,
>+ dynamicStylesheetMedia,
>+ autoHideShow = true,
>+
>+ /* Centralized function for browser feature detection
>+ - User agent string detection is only used when no good alternative is
>possible
>+ - Is executed directly for optimal performance
>+ */
>+ ua = function() {
>+ var w3cdom = typeof doc.getElementById != UNDEF && typeof
>doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
>+ u = nav.userAgent.toLowerCase(),
>+ p = nav.platform.toLowerCase(),
>+ windows = p ? /win/.test(p) : /win/.test(u),
>+ mac = p ? /mac/.test(p) : /mac/.test(u),
>+ webkit = /webkit/.test(u) ?
>parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, //
>returns either the webkit version or false if not webkit
>+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's
>solution:
>http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser
>-is-ie.html
>+ playerVersion = [0,0,0],
>+ d = null;
>+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH]
>== OBJECT) {
>+ d = nav.plugins[SHOCKWAVE_FLASH].description;
>+ if (d && !(typeof nav.mimeTypes != UNDEF &&
>nav.mimeTypes[FLASH_MIME_TYPE] &&
>!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { //
>navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
>indicates whether plug-ins are enabled or disabled in Safari 3+
>+ plugin = true;
>+ ie = false; // cascaded feature detection for Internet Explorer
>+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
>+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
>+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
>+ playerVersion[2] = /[a-zA-Z]/.test(d) ?
>parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
>+ }
>+ }
>+ else if (typeof win.ActiveXObject != UNDEF) {
>+ try {
>+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
>+ if (a) { // a will return null when ActiveX is disabled
>+ d = a.GetVariable("$version");
>+ if (d) {
>+ ie = true; // cascaded feature detection for Internet Explorer
>+ d = d.split(" ")[1].split(",");
>+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10),
>parseInt(d[2], 10)];
>+ }
>+ }
>+ }
>+ catch(e) {}
>+ }
>+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows,
>mac:mac };
>+ }(),
>+
>+ /* Cross-browser onDomLoad
>+ - Will fire an event as soon as the DOM of a web page is loaded
>+ - Internet Explorer workaround based on Diego Perini's solution:
>http://javascript.nwbox.com/IEContentLoaded/
>+ - Regular onload serves as fallback
>+ */
>+ onDomLoad = function() {
>+ if (!ua.w3) { return; }
>+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete")
>|| (typeof doc.readyState == UNDEF &&
>(doc.getElementsByTagName("body")[0] || doc.body))) { // function is
>fired after onload, e.g. when script is inserted dynamically
>+ callDomLoadFunctions();
>+ }
>+ if (!isDomLoaded) {
>+ if (typeof doc.addEventListener != UNDEF) {
>+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions,
>false);
>+ }
>+ if (ua.ie && ua.win) {
>+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
>+ if (doc.readyState == "complete") {
>+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
>+ callDomLoadFunctions();
>+ }
>+ });
>+ if (win == top) { // if not inside an iframe
>+ (function(){
>+ if (isDomLoaded) { return; }
>+ try {
>+ doc.documentElement.doScroll("left");
>+ }
>+ catch(e) {
>+ setTimeout(arguments.callee, 0);
>+ return;
>+ }
>+ callDomLoadFunctions();
>+ })();
>+ }
>+ }
>+ if (ua.wk) {
>+ (function(){
>+ if (isDomLoaded) { return; }
>+ if (!/loaded|complete/.test(doc.readyState)) {
>+ setTimeout(arguments.callee, 0);
>+ return;
>+ }
>+ callDomLoadFunctions();
>+ })();
>+ }
>+ addLoadEvent(callDomLoadFunctions);
>+ }
>+ }();
>+
>+ function callDomLoadFunctions() {
>+ if (isDomLoaded) { return; }
>+ try { // test if we can really add/remove elements to/from the DOM; we
>don't want to fire it too early
>+ var t =
>doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
>+ t.parentNode.removeChild(t);
>+ }
>+ catch (e) { return; }
>+ isDomLoaded = true;
>+ var dl = domLoadFnArr.length;
>+ for (var i = 0; i < dl; i++) {
>+ domLoadFnArr[i]();
>+ }
>+ }
>+
>+ function addDomLoadEvent(fn) {
>+ if (isDomLoaded) {
>+ fn();
>+ }
>+ else {
>+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only
>available in IE5.5+
>+ }
>+ }
>+
>+ /* Cross-browser onload
>+ - Based on James Edwards' solution:
>http://brothercake.com/site/resources/scripts/onload/
>+ - Will fire an event as soon as a web page including all of its assets
>are loaded
>+ */
>+ function addLoadEvent(fn) {
>+ if (typeof win.addEventListener != UNDEF) {
>+ win.addEventListener("load", fn, false);
>+ }
>+ else if (typeof doc.addEventListener != UNDEF) {
>+ doc.addEventListener("load", fn, false);
>+ }
>+ else if (typeof win.attachEvent != UNDEF) {
>+ addListener(win, "onload", fn);
>+ }
>+ else if (typeof win.onload == "function") {
>+ var fnOld = win.onload;
>+ win.onload = function() {
>+ fnOld();
>+ fn();
>+ };
>+ }
>+ else {
>+ win.onload = fn;
>+ }
>+ }
>+
>+ /* Main function
>+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
>+ */
>+ function main() {
>+ if (plugin) {
>+ testPlayerVersion();
>+ }
>+ else {
>+ matchVersions();
>+ }
>+ }
>+
>+ /* Detect the Flash Player version for non-Internet Explorer browsers
>+ - Detecting the plug-in version via the object element is more precise
>than using the plugins collection item's description:
>+ a. Both release and build numbers can be detected
>+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
>+ c. Avoid wrong descriptions by multiple Flash Player entries in the
>plugin Array, caused by incorrect browser imports
>+ - Disadvantage of this method is that it depends on the availability
>of the DOM, while the plugins collection is immediately available
>+ */
>+ function testPlayerVersion() {
>+ var b = doc.getElementsByTagName("body")[0];
>+ var o = createElement(OBJECT);
>+ o.setAttribute("type", FLASH_MIME_TYPE);
>+ var t = b.appendChild(o);
>+ if (t) {
>+ var counter = 0;
>+ (function(){
>+ if (typeof t.GetVariable != UNDEF) {
>+ var d = t.GetVariable("$version");
>+ if (d) {
>+ d = d.split(" ")[1].split(",");
>+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2],
>10)];
>+ }
>+ }
>+ else if (counter < 10) {
>+ counter++;
>+ setTimeout(arguments.callee, 10);
>+ return;
>+ }
>+ b.removeChild(o);
>+ t = null;
>+ matchVersions();
>+ })();
>+ }
>+ else {
>+ matchVersions();
>+ }
>+ }
>+
>+ /* Perform Flash Player and SWF version matching; static publishing only
>+ */
>+ function matchVersions() {
>+ var rl = regObjArr.length;
>+ if (rl > 0) {
>+ for (var i = 0; i < rl; i++) { // for each registered object element
>+ var id = regObjArr[i].id;
>+ var cb = regObjArr[i].callbackFn;
>+ var cbObj = {success:false, id:id};
>+ if (ua.pv[0] > 0) {
>+ var obj = getElementById(id);
>+ if (obj) {
>+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk
>< 312)) { // Flash Player version >= published SWF version: Houston, we
>have a match!
>+ setVisibility(id, true);
>+ if (cb) {
>+ cbObj.success = true;
>+ cbObj.ref = getObjectById(id);
>+ cb(cbObj);
>+ }
>+ }
>+ else if (regObjArr[i].expressInstall && canExpressInstall()) { //
>show the Adobe Express Install dialog if set by the web page author and
>if supported
>+ var att = {};
>+ att.data = regObjArr[i].expressInstall;
>+ att.width = obj.getAttribute("width") || "0";
>+ att.height = obj.getAttribute("height") || "0";
>+ if (obj.getAttribute("class")) { att.styleclass =
>obj.getAttribute("class"); }
>+ if (obj.getAttribute("align")) { att.align =
>obj.getAttribute("align"); }
>+ // parse HTML object param element's name-value pairs
>+ var par = {};
>+ var p = obj.getElementsByTagName("param");
>+ var pl = p.length;
>+ for (var j = 0; j < pl; j++) {
>+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
>+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
>+ }
>+ }
>+ showExpressInstall(att, par, id, cb);
>+ }
>+ else { // Flash Player and SWF version mismatch or an older Webkit
>engine that ignores the HTML object element's nested param elements:
>display alternative content instead of SWF
>+ displayAltContent(obj);
>+ if (cb) { cb(cbObj); }
>+ }
>+ }
>+ }
>+ else { // if no Flash Player is installed or the fp version cannot
>be detected we let the HTML object element do its job (either show a SWF
>or alternative content)
>+ setVisibility(id, true);
>+ if (cb) {
>+ var o = getObjectById(id); // test whether there is an HTML object
>element or not
>+ if (o && typeof o.SetVariable != UNDEF) {
>+ cbObj.success = true;
>+ cbObj.ref = o;
>+ }
>+ cb(cbObj);
>+ }
>+ }
>+ }
>+ }
>+ }
>+
>+ function getObjectById(objectIdStr) {
>+ var r = null;
>+ var o = getElementById(objectIdStr);
>+ if (o && o.nodeName == "OBJECT") {
>+ if (typeof o.SetVariable != UNDEF) {
>+ r = o;
>+ }
>+ else {
>+ var n = o.getElementsByTagName(OBJECT)[0];
>+ if (n) {
>+ r = n;
>+ }
>+ }
>+ }
>+ return r;
>+ }
>+
>+ /* Requirements for Adobe Express Install
>+ - only one instance can be active at a time
>+ - fp 6.0.65 or higher
>+ - Win/Mac OS only
>+ - no Webkit engines older than version 312
>+ */
>+ function canExpressInstall() {
>+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") &&
>(ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
>+ }
>+
>+ /* Show the Adobe Express Install dialog
>+ - Reference:
>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
>+ */
>+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
>+ isExpressInstallActive = true;
>+ storedCallbackFn = callbackFn || null;
>+ storedCallbackObj = {success:false, id:replaceElemIdStr};
>+ var obj = getElementById(replaceElemIdStr);
>+ if (obj) {
>+ if (obj.nodeName == "OBJECT") { // static publishing
>+ storedAltContent = abstractAltContent(obj);
>+ storedAltContentId = null;
>+ }
>+ else { // dynamic publishing
>+ storedAltContent = obj;
>+ storedAltContentId = replaceElemIdStr;
>+ }
>+ att.id = EXPRESS_INSTALL_ID;
>+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) &&
>parseInt(att.width, 10) < 310)) { att.width = "310"; }
>+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) &&
>parseInt(att.height, 10) < 137)) { att.height = "137"; }
>+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
>+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
>+ fv = "MMredirectURL=" +
>encodeURI(window.location).toString().replace(/&/g,"%26") +
>"&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
>+ if (typeof par.flashvars != UNDEF) {
>+ par.flashvars += "&" + fv;
>+ }
>+ else {
>+ par.flashvars = fv;
>+ }
>+ // IE only: when a SWF is loading (AND: not available in cache) wait
>for the readyState of the object element to become 4 before removing it,
>+ // because you cannot properly cancel a loading SWF file without
>breaking browser load references, also obj.onreadystatechange doesn't work
>+ if (ua.ie && ua.win && obj.readyState != 4) {
>+ var newObj = createElement("div");
>+ replaceElemIdStr += "SWFObjectNew";
>+ newObj.setAttribute("id", replaceElemIdStr);
>+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div
>that will be replaced by the object element that loads expressinstall.swf
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ createSWF(att, par, replaceElemIdStr);
>+ }
>+ }
>+
>+ /* Functions to abstract and display alternative content
>+ */
>+ function displayAltContent(obj) {
>+ if (ua.ie && ua.win && obj.readyState != 4) {
>+ // IE only: when a SWF is loading (AND: not available in cache) wait
>for the readyState of the object element to become 4 before removing it,
>+ // because you cannot properly cancel a loading SWF file without
>breaking browser load references, also obj.onreadystatechange doesn't work
>+ var el = createElement("div");
>+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that
>will be replaced by the alternative content
>+ el.parentNode.replaceChild(abstractAltContent(obj), el);
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ else {
>+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
>+ }
>+ }
>+
>+ function abstractAltContent(obj) {
>+ var ac = createElement("div");
>+ if (ua.win && ua.ie) {
>+ ac.innerHTML = obj.innerHTML;
>+ }
>+ else {
>+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
>+ if (nestedObj) {
>+ var c = nestedObj.childNodes;
>+ if (c) {
>+ var cl = c.length;
>+ for (var i = 0; i < cl; i++) {
>+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") &&
>!(c[i].nodeType == 8)) {
>+ ac.appendChild(c[i].cloneNode(true));
>+ }
>+ }
>+ }
>+ }
>+ }
>+ return ac;
>+ }
>+
>+ /* Cross-browser dynamic SWF creation
>+ */
>+ function createSWF(attObj, parObj, id) {
>+ var r, el = getElementById(id);
>+ if (ua.wk && ua.wk < 312) { return r; }
>+ if (el) {
>+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the
>object element, it will inherit the 'id' from the alternative content
>+ attObj.id = id;
>+ }
>+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element
>+ W3C DOM methods do not combine: fall back to outerHTML
>+ var att = "";
>+ for (var i in attObj) {
>+ if (attObj[i] != Object.prototype[i]) { // filter out prototype
>additions from other potential libraries
>+ if (i.toLowerCase() == "data") {
>+ parObj.movie = attObj[i];
>+ }
>+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4
>reserved keyword
>+ att += ' class="' + attObj[i] + '"';
>+ }
>+ else if (i.toLowerCase() != "classid") {
>+ att += ' ' + i + '="' + attObj[i] + '"';
>+ }
>+ }
>+ }
>+ var par = "";
>+ for (var j in parObj) {
>+ if (parObj[j] != Object.prototype[j]) { // filter out prototype
>additions from other potential libraries
>+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
>+ }
>+ }
>+ el.outerHTML = '<object
>classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par +
>'</object>';
>+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object
>'leaks' on unload (dynamic publishing only)
>+ r = getElementById(attObj.id);
>+ }
>+ else { // well-behaving browsers
>+ var o = createElement(OBJECT);
>+ o.setAttribute("type", FLASH_MIME_TYPE);
>+ for (var m in attObj) {
>+ if (attObj[m] != Object.prototype[m]) { // filter out prototype
>additions from other potential libraries
>+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4
>reserved keyword
>+ o.setAttribute("class", attObj[m]);
>+ }
>+ else if (m.toLowerCase() != "classid") { // filter out IE specific
>attribute
>+ o.setAttribute(m, attObj[m]);
>+ }
>+ }
>+ }
>+ for (var n in parObj) {
>+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie")
>{ // filter out prototype additions from other potential libraries and IE
>specific param element
>+ createObjParam(o, n, parObj[n]);
>+ }
>+ }
>+ el.parentNode.replaceChild(o, el);
>+ r = o;
>+ }
>+ }
>+ return r;
>+ }
>+
>+ function createObjParam(el, pName, pValue) {
>+ var p = createElement("param");
>+ p.setAttribute("name", pName);
>+ p.setAttribute("value", pValue);
>+ el.appendChild(p);
>+ }
>+
>+ /* Cross-browser SWF removal
>+ - Especially needed to safely and completely remove a SWF in Internet
>Explorer
>+ */
>+ function removeSWF(id) {
>+ var obj = getElementById(id);
>+ if (obj && obj.nodeName == "OBJECT") {
>+ if (ua.ie && ua.win) {
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ removeObjectInIE(id);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ else {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ }
>+ }
>+
>+ function removeObjectInIE(id) {
>+ var obj = getElementById(id);
>+ if (obj) {
>+ for (var i in obj) {
>+ if (typeof obj[i] == "function") {
>+ obj[i] = null;
>+ }
>+ }
>+ obj.parentNode.removeChild(obj);
>+ }
>+ }
>+
>+ /* Functions to optimize JavaScript compression
>+ */
>+ function getElementById(id) {
>+ var el = null;
>+ try {
>+ el = doc.getElementById(id);
>+ }
>+ catch (e) {}
>+ return el;
>+ }
>+
>+ function createElement(el) {
>+ return doc.createElement(el);
>+ }
>+
>+ /* Updated attachEvent function for Internet Explorer
>+ - Stores attachEvent information in an Array, so on unload the
>detachEvent functions can be called to avoid memory leaks
>+ */
>+ function addListener(target, eventType, fn) {
>+ target.attachEvent(eventType, fn);
>+ listenersArr[listenersArr.length] = [target, eventType, fn];
>+ }
>+
>+ /* Flash Player and SWF content version matching
>+ */
>+ function hasPlayerVersion(rv) {
>+ var pv = ua.pv, v = rv.split(".");
>+ v[0] = parseInt(v[0], 10);
>+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9"
>instead of "9.0.0"
>+ v[2] = parseInt(v[2], 10) || 0;
>+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] ==
>v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
>+ }
>+
>+ /* Cross-browser dynamic CSS creation
>+ - Based on Bobby van der Sluis' solution:
>http://www.bobbyvandersluis.com/articles/dynamicCSS.php
>+ */
>+ function createCSS(sel, decl, media, newStyle) {
>+ if (ua.ie && ua.mac) { return; }
>+ var h = doc.getElementsByTagName("head")[0];
>+ if (!h) { return; } // to also support badly authored HTML pages that
>lack a head element
>+ var m = (media && typeof media == "string") ? media : "screen";
>+ if (newStyle) {
>+ dynamicStylesheet = null;
>+ dynamicStylesheetMedia = null;
>+ }
>+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
>+ // create dynamic stylesheet + get a global reference to it
>+ var s = createElement("style");
>+ s.setAttribute("type", "text/css");
>+ s.setAttribute("media", m);
>+ dynamicStylesheet = h.appendChild(s);
>+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF &&
>doc.styleSheets.length > 0) {
>+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
>+ }
>+ dynamicStylesheetMedia = m;
>+ }
>+ // add style rule
>+ if (ua.ie && ua.win) {
>+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
>+ dynamicStylesheet.addRule(sel, decl);
>+ }
>+ }
>+ else {
>+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
>+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl +
>"}"));
>+ }
>+ }
>+ }
>+
>+ function setVisibility(id, isVisible) {
>+ if (!autoHideShow) { return; }
>+ var v = isVisible ? "visible" : "hidden";
>+ if (isDomLoaded && getElementById(id)) {
>+ getElementById(id).style.visibility = v;
>+ }
>+ else {
>+ createCSS("#" + id, "visibility:" + v);
>+ }
>+ }
>+
>+ /* Filter to avoid XSS attacks
>+ */
>+ function urlEncodeIfNecessary(s) {
>+ var regex = /[\\\"<>\.;]/;
>+ var hasBadChars = regex.exec(s) != null;
>+ return hasBadChars && typeof encodeURIComponent != UNDEF ?
>encodeURIComponent(s) : s;
>+ }
>+
>+ /* Release memory to avoid memory leaks caused by closures, fix hanging
>audio/video threads and force open sockets/NetConnections to disconnect
>(Internet Explorer only)
>+ */
>+ var cleanup = function() {
>+ if (ua.ie && ua.win) {
>+ window.attachEvent("onunload", function() {
>+ // remove listeners to avoid memory leaks
>+ var ll = listenersArr.length;
>+ for (var i = 0; i < ll; i++) {
>+ listenersArr[i][0].detachEvent(listenersArr[i][1],
>listenersArr[i][2]);
>+ }
>+ // cleanup dynamically embedded objects to fix audio/video threads
>and force open sockets and NetConnections to disconnect
>+ var il = objIdArr.length;
>+ for (var j = 0; j < il; j++) {
>+ removeSWF(objIdArr[j]);
>+ }
>+ // cleanup library's main closures to avoid memory leaks
>+ for (var k in ua) {
>+ ua[k] = null;
>+ }
>+ ua = null;
>+ for (var l in swfobject) {
>+ swfobject[l] = null;
>+ }
>+ swfobject = null;
>+ });
>+ }
>+ }();
>+
>+ return {
>+ /* Public API
>+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
>+ */
>+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr,
>callbackFn) {
>+ if (ua.w3 && objectIdStr && swfVersionStr) {
>+ var regObj = {};
>+ regObj.id = objectIdStr;
>+ regObj.swfVersion = swfVersionStr;
>+ regObj.expressInstall = xiSwfUrlStr;
>+ regObj.callbackFn = callbackFn;
>+ regObjArr[regObjArr.length] = regObj;
>+ setVisibility(objectIdStr, false);
>+ }
>+ else if (callbackFn) {
>+ callbackFn({success:false, id:objectIdStr});
>+ }
>+ },
>+
>+ getObjectById: function(objectIdStr) {
>+ if (ua.w3) {
>+ return getObjectById(objectIdStr);
>+ }
>+ },
>+
>+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr,
>swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
>+ var callbackObj = {success:false, id:replaceElemIdStr};
>+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr
>&& widthStr && heightStr && swfVersionStr) {
>+ setVisibility(replaceElemIdStr, false);
>+ addDomLoadEvent(function() {
>+ widthStr += ""; // auto-convert to string
>+ heightStr += "";
>+ var att = {};
>+ if (attObj && typeof attObj === OBJECT) {
>+ for (var i in attObj) { // copy object to avoid the use of
>references, because web authors often reuse attObj for multiple SWFs
>+ att[i] = attObj[i];
>+ }
>+ }
>+ att.data = swfUrlStr;
>+ att.width = widthStr;
>+ att.height = heightStr;
>+ var par = {};
>+ if (parObj && typeof parObj === OBJECT) {
>+ for (var j in parObj) { // copy object to avoid the use of
>references, because web authors often reuse parObj for multiple SWFs
>+ par[j] = parObj[j];
>+ }
>+ }
>+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
>+ for (var k in flashvarsObj) { // copy object to avoid the use of
>references, because web authors often reuse flashvarsObj for multiple SWFs
>+ if (typeof par.flashvars != UNDEF) {
>+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
>+ }
>+ else {
>+ par.flashvars = k + "=" + flashvarsObj[k];
>+ }
>+ }
>+ }
>+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
>+ var obj = createSWF(att, par, replaceElemIdStr);
>+ if (att.id == replaceElemIdStr) {
>+ setVisibility(replaceElemIdStr, true);
>+ }
>+ callbackObj.success = true;
>+ callbackObj.ref = obj;
>+ }
>+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe
>Express Install
>+ att.data = xiSwfUrlStr;
>+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
>+ return;
>+ }
>+ else { // show alternative content
>+ setVisibility(replaceElemIdStr, true);
>+ }
>+ if (callbackFn) { callbackFn(callbackObj); }
>+ });
>+ }
>+ else if (callbackFn) { callbackFn(callbackObj); }
>+ },
>+
>+ switchOffAutoHideShow: function() {
>+ autoHideShow = false;
>+ },
>+
>+ ua: ua,
>+
>+ getFlashPlayerVersion: function() {
>+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
>+ },
>+
>+ hasFlashPlayerVersion: hasPlayerVersion,
>+
>+ createSWF: function(attObj, parObj, replaceElemIdStr) {
>+ if (ua.w3) {
>+ return createSWF(attObj, parObj, replaceElemIdStr);
>+ }
>+ else {
>+ return undefined;
>+ }
>+ },
>+
>+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
>+ if (ua.w3 && canExpressInstall()) {
>+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
>+ }
>+ },
>+
>+ removeSWF: function(objElemIdStr) {
>+ if (ua.w3) {
>+ removeSWF(objElemIdStr);
>+ }
>+ },
>+
>+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
>+ if (ua.w3) {
>+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
>+ }
>+ },
>+
>+ addDomLoadEvent: addDomLoadEvent,
>+
>+ addLoadEvent: addLoadEvent,
>+
>+ getQueryParamValue: function(param) {
>+ var q = doc.location.search || doc.location.hash;
>+ if (q) {
>+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
>+ if (param == null) {
>+ return urlEncodeIfNecessary(q);
>+ }
>+ var pairs = q.split("&");
>+ for (var i = 0; i < pairs.length; i++) {
>+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
>+ return
>urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
>+ }
>+ }
>+ }
>+ return "";
>+ },
>+
>+ // For internal usage only
>+ expressInstallCallback: function() {
>+ if (isExpressInstallActive) {
>+ var obj = getElementById(EXPRESS_INSTALL_ID);
>+ if (obj && storedAltContent) {
>+ obj.parentNode.replaceChild(storedAltContent, obj);
>+ if (storedAltContentId) {
>+ setVisibility(storedAltContentId, true);
>+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
>+ }
>+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
>+ }
>+ isExpressInstallActive = false;
>+ }
>+ }
>+ };
>+}();
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.ja
>r
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar
>new file mode 100644
>index 0000000..e44ac0c
>Binary files /dev/null and
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar differ
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>new file mode 100644
>index 0000000..ab8a7db
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>@@ -0,0 +1,50 @@
>+<?xml version="1.0" encoding="utf-8"?>
>+<!--
>+ Licensed to the Apache Software Foundation (ASF) under one or more
>+ contributor license agreements. See the NOTICE file distributed with
>+ this work for additional information regarding copyright ownership.
>+ The ASF licenses this file to You under the Apache License, Version 2.0
>+ (the "License"); you may not use this file except in compliance with
>+ the License. You may obtain a copy of the License at
>+
>+ http://www.apache.org/licenses/LICENSE-2.0
>+
>+ Unless required by applicable law or agreed to in writing, software
>+ distributed under the License is distributed on an "AS IS" BASIS,
>+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ See the License for the specific language governing permissions and
>+ limitations under the License.
>+-->
>+
>+<!-- This is an auto generated file and is not intended for
>modification. -->
>+
>+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>+ xmlns:s="library://ns.adobe.com/flex/spark"
>+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
>minHeight="600" xmlns:flexui="flexunit.flexui.*"
>creationComplete="onCreationComplete()">
>+ <fx:Script>
>+ <![CDATA[
>+ import math.testcases.BasicCircleTest;
>+
>+ import org.flexunit.runner.FlexUnitCore;
>+
>+ public function currentRunTestSuite():Array
>+ {
>+ var testsToRun:Array = new Array();
>+ testsToRun.push( BasicCircleTest );
>+ return testsToRun;
>+ }
>+
>+
>+ private function onCreationComplete():void
>+ {
>+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(),
>"FlexUnit4Training");
>+ }
>+
>+ ]]>
>+ </fx:Script>
>+ <fx:Declarations>
>+ <!-- Place non-visual elements (e.g., services, value objects) here -->
>+ </fx:Declarations>
>+
>+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
>+</s:Application>
>\ No newline at end of file
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/mat
>h/Circle.as
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>new file mode 100644
>index 0000000..5f4978a
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>@@ -0,0 +1,131 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+package net.digitalprimates.math {
>+ import flash.geom.Point;
>+
>+ /**
>+ * Class to represent a mathematical circle in addition to
>circle-specific convenience methods.
>+ *
>+ * @author mlabriola
>+ *
>+ */
>+ public class Circle {
>+ /**
>+ * Constant representing the number of radians in a circle
>+ */
>+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
>+
>+ private var _origin:Point = new Point( 0, 0 );
>+ private var _radius:Number;
>+
>+ /**
>+ * Returns the circle's origin point as a
><code>flash.geom.Point</code> object.
>+ * The <code>origin</code> is a read only property supplied during
>the instantiation
>+ * of the Circle.
>+ *
>+ * @return The circle's origin point.
>+ *
>+ */
>+ public function get origin():Point {
>+ return _origin;
>+ }
>+
>+ /**
>+ * Returns the circle's radius as a <code>Number</code>.
>+ * The <code>radius</code> is a read only property supplied during
>the instantiation
>+ * of the Circle.
>+ *
>+ * @return The circle's radius.
>+ */
>+ public function get radius():Number {
>+ return _radius;
>+ }
>+
>+ /**
>+ * Returns the circle's diameter based on the <code>radius</code>
>property.
>+ * The <code>diameter</code> is a read only property.
>+ *
>+ * @see #radius
>+ * @return The circle's diameter.
>+ */
>+ public function get diameter():Number {
>+ return radius * 2;
>+ }
>+
>+ /**
>+ * Returns a point on the circle at a given radian offset.
>+ *
>+ * @param t radian position along the circle. 0 is the top-most point
>of the circle.
>+ * @return a Point object describing the cartesian coordinate of the
>point.
>+ *
>+ */
>+ public function getPointOnCircle( t:Number ):Point {
>+ var x:Number = origin.x + ( radius * Math.cos( t ) );
>+ var y:Number = origin.y + ( radius * Math.sin( t ) );
>+
>+ return new Point( x, y );
>+ }
>+
>+ /**
>+ *
>+ * Convenience method for converting radians to degrees.
>+ *
>+ * @param radians a radian offset from the top-most point of the
>circle.
>+ * @return a corresponding angle represented in degrees.
>+ *
>+ */
>+ public function radiansToDegrees( radians:Number ):Number {
>+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
>+ }
>+
>+ /**
>+ * Comparison method to determine circle equivalence (same center and
>radius).
>+ *
>+ * @param circle a circle for comparison
>+ * @return a boolean indicating if the circles are equivalent
>+ *
>+ */
>+ public function equals( circle:Circle ):Boolean {
>+ var equal:Boolean = false;
>+
>+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin
>) && ( circle.origin ) ) {
>+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y ==
>circle.origin.y ) ) {
>+ equal = true;
>+ }
>+ }
>+
>+ return equal;
>+ }
>+
>+ /**
>+ * Creates a new circle
>+ *
>+ * @param origin the origin point of the new circle
>+ * @param radius the radius of the new circle
>+ *
>+ */
>+ public function Circle( origin:Point, radius:Number ) {
>+
>+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
>+ throw new RangeError("Radius must be a positive Number");
>+ }
>+
>+ this._origin = origin;
>+ this._radius = radius;
>+ }
>+ }
>+}
>\ No newline at end of file
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicC
>ircleTest.as
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>new file mode 100644
>index 0000000..f85bf23
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>@@ -0,0 +1,94 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+package math.testcases {
>+ import flash.geom.Point;
>+
>+ import net.digitalprimates.math.Circle;
>+
>+ import org.flexunit.asserts.assertEquals;
>+ import org.flexunit.asserts.assertFalse;
>+ import org.flexunit.asserts.assertTrue;
>+
>+ public class BasicCircleTest {
>+
>+ [Test]
>+ public function shouldReturnProvidedRadius():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 5, circle.radius );
>+ }
>+
>+ [Test]
>+ public function shouldComputeCorrectDiameter ():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 10, circle.diameter );
>+ }
>+
>+ [Test]
>+ public function shouldReturnProvidedOrigin():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 0, circle.origin.x );
>+ assertEquals( 0, circle.origin.y );
>+ }
>+
>+ [Test]
>+ public function shouldReturnTrueForEqualCircle():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
>+
>+ assertTrue( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldReturnFalseForUnequalOrigin():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
>+
>+ assertFalse( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldReturnFalseForUnequalRadius():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
>+
>+ assertFalse( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldGetPointsOnCircle():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var point:Point;
>+
>+ //top-most point of circle
>+ point = circle.getPointOnCircle( 0 );
>+ assertEquals( 5, point.x );
>+ assertEquals( 0, point.y );
>+
>+ //bottom-most point of circle
>+ point = circle.getPointOnCircle( Math.PI );
>+ assertEquals( -5, point.x );
>+ assertEquals( 0, point.y );
>+ }
>+
>+ [Test]
>+ public function shouldThrowRangeError():void {
>+
>+ }
>+
>+
>+ }
>+}
>\ No newline at end of file
>
[30/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..2628e75
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.fxpProperties
new file mode 100644
index 0000000..872e071
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="062bea54-96eb-42f3-be43-9384a1276492" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="062bea54-96eb-42f3-be43-9384a1276492"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.project
new file mode 100644
index 0000000..9e8e960
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt3</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
new file mode 100644
index 0000000..e44ac0c
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..ab8a7db
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ import org.flexunit.runner.FlexUnitCore;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[33/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f85bf23
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.fxpProperties
new file mode 100644
index 0000000..bde0485
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.project
new file mode 100644
index 0000000..9e8e960
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training_wt3</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/index.template.html
new file mode 100644
index 0000000..2146ca8
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/index.template.html
@@ -0,0 +1,121 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0014)about:internet -->
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <!--
+ Smart developers always View Source.
+
+ This application was built using Adobe Flex, an open source framework
+ for building rich Internet applications that get delivered via the
+ Flash Player or to desktops via Adobe AIR.
+
+ Learn more about Flex at http://flex.org
+ // -->
+ <head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
+ the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
+ the percentage of the height of its parent container, which has to be set explicitly. Initially,
+ don't display flashContent div so it won't show if JavaScript disabled.
+ -->
+ <style type="text/css" media="screen">
+ html, body { height:100%; }
+ body { margin:0; padding:0; overflow:auto; text-align:center;
+ background-color: ${bgcolor}; }
+ #flashContent { display:none; }
+ </style>
+
+ <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
+ <!-- BEGIN Browser History required section ${useBrowserHistory}>
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
+ <script type="text/javascript" src="history/history.js"></script>
+ <!${useBrowserHistory} END Browser History required section -->
+
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript">
+ <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
+ var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
+ <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
+ var xiSwfUrlStr = "${expressInstallSwf}";
+ var flashvars = {};
+ var params = {};
+ params.quality = "high";
+ params.bgcolor = "${bgcolor}";
+ params.allowscriptaccess = "sameDomain";
+ params.allowfullscreen = "true";
+ var attributes = {};
+ attributes.id = "${application}";
+ attributes.name = "${application}";
+ attributes.align = "middle";
+ swfobject.embedSWF(
+ "${swf}.swf", "flashContent",
+ "${width}", "${height}",
+ swfVersionStr, xiSwfUrlStr,
+ flashvars, params, attributes);
+ <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
+ swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ </script>
+ </head>
+ <body>
+ <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
+ JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
+ when JavaScript is disabled.
+ -->
+ <div id="flashContent">
+ <p>
+ To view this page ensure that Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is installed.
+ </p>
+ <script type="text/javascript">
+ var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
+ document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
+ </script>
+ </div>
+
+ <noscript>
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
+ <param name="movie" value="${swf}.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="${bgcolor}" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <param name="allowFullScreen" value="true" />
+ <!--<![endif]-->
+ <!--[if gte IE 6]>-->
+ <p>
+ Either scripts and active content are not permitted to run or Adobe Flash Player version
+ ${version_major}.${version_minor}.${version_revision} or greater is not installed.
+ </p>
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </noscript>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
new file mode 100644
index 0000000..bdc3437
Binary files /dev/null and b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/playerProductInstall.swf differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Complete/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
[07/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..689430b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d706f81
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetTopPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( 0 );
+
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldGetBottomPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( Math.PI );
+
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldGetRightPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( Math.PI/2 );
+
+ assertEquals( 0, point.x );
+ assertEquals( 5, point.y );
+ }
+
+ [Test]
+ public function shouldGetLeftPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
+
+ assertEquals( 0, point.x );
+ assertEquals( -5, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/start/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
[24/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
deleted file mode 100644
index 5f4978a..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/src/net/digitalprimates/math/Circle.as
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.digitalprimates.math {
- import flash.geom.Point;
-
- /**
- * Class to represent a mathematical circle in addition to circle-specific convenience methods.
- *
- * @author mlabriola
- *
- */
- public class Circle {
- /**
- * Constant representing the number of radians in a circle
- */
- public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
-
- private var _origin:Point = new Point( 0, 0 );
- private var _radius:Number;
-
- /**
- * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
- * The <code>origin</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's origin point.
- *
- */
- public function get origin():Point {
- return _origin;
- }
-
- /**
- * Returns the circle's radius as a <code>Number</code>.
- * The <code>radius</code> is a read only property supplied during the instantiation
- * of the Circle.
- *
- * @return The circle's radius.
- */
- public function get radius():Number {
- return _radius;
- }
-
- /**
- * Returns the circle's diameter based on the <code>radius</code> property.
- * The <code>diameter</code> is a read only property.
- *
- * @see #radius
- * @return The circle's diameter.
- */
- public function get diameter():Number {
- return radius * 2;
- }
-
- /**
- * Returns a point on the circle at a given radian offset.
- *
- * @param t radian position along the circle. 0 is the top-most point of the circle.
- * @return a Point object describing the cartesian coordinate of the point.
- *
- */
- public function getPointOnCircle( t:Number ):Point {
- var x:Number = origin.x + ( radius * Math.cos( t ) );
- var y:Number = origin.y + ( radius * Math.sin( t ) );
-
- return new Point( x, y );
- }
-
- /**
- *
- * Convenience method for converting radians to degrees.
- *
- * @param radians a radian offset from the top-most point of the circle.
- * @return a corresponding angle represented in degrees.
- *
- */
- public function radiansToDegrees( radians:Number ):Number {
- return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
- }
-
- /**
- * Comparison method to determine circle equivalence (same center and radius).
- *
- * @param circle a circle for comparison
- * @return a boolean indicating if the circles are equivalent
- *
- */
- public function equals( circle:Circle ):Boolean {
- var equal:Boolean = false;
-
- if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
- if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
- equal = true;
- }
- }
-
- return equal;
- }
-
- /**
- * Creates a new circle
- *
- * @param origin the origin point of the new circle
- * @param radius the radius of the new circle
- *
- */
- public function Circle( origin:Point, radius:Number ) {
-
- if ( ( radius <= 0 ) || isNaN( radius ) ) {
- throw new RangeError("Radius must be a positive Number");
- }
-
- this._origin = origin;
- this._radius = radius;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
deleted file mode 100644
index 2628e75..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt2/tests/math/testcases/BasicCircleTest.as
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package math.testcases {
- import flash.geom.Point;
-
- import net.digitalprimates.math.Circle;
-
- import org.flexunit.asserts.assertEquals;
- import org.flexunit.asserts.assertFalse;
- import org.flexunit.asserts.assertTrue;
-
- public class BasicCircleTest {
-
- [Test]
- public function shouldReturnProvidedRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 5, circle.radius );
- }
-
- [Test]
- public function shouldComputeCorrectDiameter ():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 10, circle.diameter );
- }
-
- [Test]
- public function shouldReturnProvidedOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- assertEquals( 0, circle.origin.x );
- assertEquals( 0, circle.origin.y );
- }
-
-
- [Test]
- public function shouldReturnTrueForEqualCircle():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
-
- assertTrue( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalOrigin():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldReturnFalseForUnequalRadius():void {
- var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
- var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
-
- assertFalse( circle.equals( circle2 ) );
- }
-
- [Test]
- public function shouldGetPointsOnCircle():void {
-
- }
-
- [Test]
- public function shouldThrowRangeError():void {
-
- }
-
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
deleted file mode 100644
index 872e071..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="062bea54-96eb-42f3-be43-9384a1276492" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="062bea54-96eb-42f3-be43-9384a1276492"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
deleted file mode 100644
index 9e8e960..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt3</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar
deleted file mode 100644
index e44ac0c..0000000
Binary files a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
deleted file mode 100644
index ab8a7db..0000000
--- a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is an auto generated file and is not intended for modification. -->
-
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- import org.flexunit.runner.FlexUnitCore;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file
Re: [01/50] [abbrv] rename folder
Posted by Alex Harui <ah...@adobe.com>.
SWFObject probably shouldn't be in the repo.
On 3/15/14 6:00 PM, "jmclean@apache.org" <jm...@apache.org> wrote:
>Repository: flex-flexunit
>Updated Branches:
> refs/heads/develop fede2751f -> 360e38257
>
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfobject.js
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>new file mode 100644
>index 0000000..c862aae
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/html-template/swfo
>bject.js
>@@ -0,0 +1,793 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
>+ is released under the MIT License
><http://www.opensource.org/licenses/mit-license.php>
>+*/
>+
>+var swfobject = function() {
>+
>+ var UNDEF = "undefined",
>+ OBJECT = "object",
>+ SHOCKWAVE_FLASH = "Shockwave Flash",
>+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
>+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
>+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
>+ ON_READY_STATE_CHANGE = "onreadystatechange",
>+
>+ win = window,
>+ doc = document,
>+ nav = navigator,
>+
>+ plugin = false,
>+ domLoadFnArr = [main],
>+ regObjArr = [],
>+ objIdArr = [],
>+ listenersArr = [],
>+ storedAltContent,
>+ storedAltContentId,
>+ storedCallbackFn,
>+ storedCallbackObj,
>+ isDomLoaded = false,
>+ isExpressInstallActive = false,
>+ dynamicStylesheet,
>+ dynamicStylesheetMedia,
>+ autoHideShow = true,
>+
>+ /* Centralized function for browser feature detection
>+ - User agent string detection is only used when no good alternative is
>possible
>+ - Is executed directly for optimal performance
>+ */
>+ ua = function() {
>+ var w3cdom = typeof doc.getElementById != UNDEF && typeof
>doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
>+ u = nav.userAgent.toLowerCase(),
>+ p = nav.platform.toLowerCase(),
>+ windows = p ? /win/.test(p) : /win/.test(u),
>+ mac = p ? /mac/.test(p) : /mac/.test(u),
>+ webkit = /webkit/.test(u) ?
>parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, //
>returns either the webkit version or false if not webkit
>+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's
>solution:
>http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser
>-is-ie.html
>+ playerVersion = [0,0,0],
>+ d = null;
>+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH]
>== OBJECT) {
>+ d = nav.plugins[SHOCKWAVE_FLASH].description;
>+ if (d && !(typeof nav.mimeTypes != UNDEF &&
>nav.mimeTypes[FLASH_MIME_TYPE] &&
>!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { //
>navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
>indicates whether plug-ins are enabled or disabled in Safari 3+
>+ plugin = true;
>+ ie = false; // cascaded feature detection for Internet Explorer
>+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
>+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
>+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
>+ playerVersion[2] = /[a-zA-Z]/.test(d) ?
>parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
>+ }
>+ }
>+ else if (typeof win.ActiveXObject != UNDEF) {
>+ try {
>+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
>+ if (a) { // a will return null when ActiveX is disabled
>+ d = a.GetVariable("$version");
>+ if (d) {
>+ ie = true; // cascaded feature detection for Internet Explorer
>+ d = d.split(" ")[1].split(",");
>+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10),
>parseInt(d[2], 10)];
>+ }
>+ }
>+ }
>+ catch(e) {}
>+ }
>+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows,
>mac:mac };
>+ }(),
>+
>+ /* Cross-browser onDomLoad
>+ - Will fire an event as soon as the DOM of a web page is loaded
>+ - Internet Explorer workaround based on Diego Perini's solution:
>http://javascript.nwbox.com/IEContentLoaded/
>+ - Regular onload serves as fallback
>+ */
>+ onDomLoad = function() {
>+ if (!ua.w3) { return; }
>+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete")
>|| (typeof doc.readyState == UNDEF &&
>(doc.getElementsByTagName("body")[0] || doc.body))) { // function is
>fired after onload, e.g. when script is inserted dynamically
>+ callDomLoadFunctions();
>+ }
>+ if (!isDomLoaded) {
>+ if (typeof doc.addEventListener != UNDEF) {
>+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions,
>false);
>+ }
>+ if (ua.ie && ua.win) {
>+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
>+ if (doc.readyState == "complete") {
>+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
>+ callDomLoadFunctions();
>+ }
>+ });
>+ if (win == top) { // if not inside an iframe
>+ (function(){
>+ if (isDomLoaded) { return; }
>+ try {
>+ doc.documentElement.doScroll("left");
>+ }
>+ catch(e) {
>+ setTimeout(arguments.callee, 0);
>+ return;
>+ }
>+ callDomLoadFunctions();
>+ })();
>+ }
>+ }
>+ if (ua.wk) {
>+ (function(){
>+ if (isDomLoaded) { return; }
>+ if (!/loaded|complete/.test(doc.readyState)) {
>+ setTimeout(arguments.callee, 0);
>+ return;
>+ }
>+ callDomLoadFunctions();
>+ })();
>+ }
>+ addLoadEvent(callDomLoadFunctions);
>+ }
>+ }();
>+
>+ function callDomLoadFunctions() {
>+ if (isDomLoaded) { return; }
>+ try { // test if we can really add/remove elements to/from the DOM; we
>don't want to fire it too early
>+ var t =
>doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
>+ t.parentNode.removeChild(t);
>+ }
>+ catch (e) { return; }
>+ isDomLoaded = true;
>+ var dl = domLoadFnArr.length;
>+ for (var i = 0; i < dl; i++) {
>+ domLoadFnArr[i]();
>+ }
>+ }
>+
>+ function addDomLoadEvent(fn) {
>+ if (isDomLoaded) {
>+ fn();
>+ }
>+ else {
>+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only
>available in IE5.5+
>+ }
>+ }
>+
>+ /* Cross-browser onload
>+ - Based on James Edwards' solution:
>http://brothercake.com/site/resources/scripts/onload/
>+ - Will fire an event as soon as a web page including all of its assets
>are loaded
>+ */
>+ function addLoadEvent(fn) {
>+ if (typeof win.addEventListener != UNDEF) {
>+ win.addEventListener("load", fn, false);
>+ }
>+ else if (typeof doc.addEventListener != UNDEF) {
>+ doc.addEventListener("load", fn, false);
>+ }
>+ else if (typeof win.attachEvent != UNDEF) {
>+ addListener(win, "onload", fn);
>+ }
>+ else if (typeof win.onload == "function") {
>+ var fnOld = win.onload;
>+ win.onload = function() {
>+ fnOld();
>+ fn();
>+ };
>+ }
>+ else {
>+ win.onload = fn;
>+ }
>+ }
>+
>+ /* Main function
>+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
>+ */
>+ function main() {
>+ if (plugin) {
>+ testPlayerVersion();
>+ }
>+ else {
>+ matchVersions();
>+ }
>+ }
>+
>+ /* Detect the Flash Player version for non-Internet Explorer browsers
>+ - Detecting the plug-in version via the object element is more precise
>than using the plugins collection item's description:
>+ a. Both release and build numbers can be detected
>+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
>+ c. Avoid wrong descriptions by multiple Flash Player entries in the
>plugin Array, caused by incorrect browser imports
>+ - Disadvantage of this method is that it depends on the availability
>of the DOM, while the plugins collection is immediately available
>+ */
>+ function testPlayerVersion() {
>+ var b = doc.getElementsByTagName("body")[0];
>+ var o = createElement(OBJECT);
>+ o.setAttribute("type", FLASH_MIME_TYPE);
>+ var t = b.appendChild(o);
>+ if (t) {
>+ var counter = 0;
>+ (function(){
>+ if (typeof t.GetVariable != UNDEF) {
>+ var d = t.GetVariable("$version");
>+ if (d) {
>+ d = d.split(" ")[1].split(",");
>+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2],
>10)];
>+ }
>+ }
>+ else if (counter < 10) {
>+ counter++;
>+ setTimeout(arguments.callee, 10);
>+ return;
>+ }
>+ b.removeChild(o);
>+ t = null;
>+ matchVersions();
>+ })();
>+ }
>+ else {
>+ matchVersions();
>+ }
>+ }
>+
>+ /* Perform Flash Player and SWF version matching; static publishing only
>+ */
>+ function matchVersions() {
>+ var rl = regObjArr.length;
>+ if (rl > 0) {
>+ for (var i = 0; i < rl; i++) { // for each registered object element
>+ var id = regObjArr[i].id;
>+ var cb = regObjArr[i].callbackFn;
>+ var cbObj = {success:false, id:id};
>+ if (ua.pv[0] > 0) {
>+ var obj = getElementById(id);
>+ if (obj) {
>+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk
>< 312)) { // Flash Player version >= published SWF version: Houston, we
>have a match!
>+ setVisibility(id, true);
>+ if (cb) {
>+ cbObj.success = true;
>+ cbObj.ref = getObjectById(id);
>+ cb(cbObj);
>+ }
>+ }
>+ else if (regObjArr[i].expressInstall && canExpressInstall()) { //
>show the Adobe Express Install dialog if set by the web page author and
>if supported
>+ var att = {};
>+ att.data = regObjArr[i].expressInstall;
>+ att.width = obj.getAttribute("width") || "0";
>+ att.height = obj.getAttribute("height") || "0";
>+ if (obj.getAttribute("class")) { att.styleclass =
>obj.getAttribute("class"); }
>+ if (obj.getAttribute("align")) { att.align =
>obj.getAttribute("align"); }
>+ // parse HTML object param element's name-value pairs
>+ var par = {};
>+ var p = obj.getElementsByTagName("param");
>+ var pl = p.length;
>+ for (var j = 0; j < pl; j++) {
>+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
>+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
>+ }
>+ }
>+ showExpressInstall(att, par, id, cb);
>+ }
>+ else { // Flash Player and SWF version mismatch or an older Webkit
>engine that ignores the HTML object element's nested param elements:
>display alternative content instead of SWF
>+ displayAltContent(obj);
>+ if (cb) { cb(cbObj); }
>+ }
>+ }
>+ }
>+ else { // if no Flash Player is installed or the fp version cannot
>be detected we let the HTML object element do its job (either show a SWF
>or alternative content)
>+ setVisibility(id, true);
>+ if (cb) {
>+ var o = getObjectById(id); // test whether there is an HTML object
>element or not
>+ if (o && typeof o.SetVariable != UNDEF) {
>+ cbObj.success = true;
>+ cbObj.ref = o;
>+ }
>+ cb(cbObj);
>+ }
>+ }
>+ }
>+ }
>+ }
>+
>+ function getObjectById(objectIdStr) {
>+ var r = null;
>+ var o = getElementById(objectIdStr);
>+ if (o && o.nodeName == "OBJECT") {
>+ if (typeof o.SetVariable != UNDEF) {
>+ r = o;
>+ }
>+ else {
>+ var n = o.getElementsByTagName(OBJECT)[0];
>+ if (n) {
>+ r = n;
>+ }
>+ }
>+ }
>+ return r;
>+ }
>+
>+ /* Requirements for Adobe Express Install
>+ - only one instance can be active at a time
>+ - fp 6.0.65 or higher
>+ - Win/Mac OS only
>+ - no Webkit engines older than version 312
>+ */
>+ function canExpressInstall() {
>+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") &&
>(ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
>+ }
>+
>+ /* Show the Adobe Express Install dialog
>+ - Reference:
>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
>+ */
>+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
>+ isExpressInstallActive = true;
>+ storedCallbackFn = callbackFn || null;
>+ storedCallbackObj = {success:false, id:replaceElemIdStr};
>+ var obj = getElementById(replaceElemIdStr);
>+ if (obj) {
>+ if (obj.nodeName == "OBJECT") { // static publishing
>+ storedAltContent = abstractAltContent(obj);
>+ storedAltContentId = null;
>+ }
>+ else { // dynamic publishing
>+ storedAltContent = obj;
>+ storedAltContentId = replaceElemIdStr;
>+ }
>+ att.id = EXPRESS_INSTALL_ID;
>+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) &&
>parseInt(att.width, 10) < 310)) { att.width = "310"; }
>+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) &&
>parseInt(att.height, 10) < 137)) { att.height = "137"; }
>+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
>+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
>+ fv = "MMredirectURL=" +
>encodeURI(window.location).toString().replace(/&/g,"%26") +
>"&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
>+ if (typeof par.flashvars != UNDEF) {
>+ par.flashvars += "&" + fv;
>+ }
>+ else {
>+ par.flashvars = fv;
>+ }
>+ // IE only: when a SWF is loading (AND: not available in cache) wait
>for the readyState of the object element to become 4 before removing it,
>+ // because you cannot properly cancel a loading SWF file without
>breaking browser load references, also obj.onreadystatechange doesn't work
>+ if (ua.ie && ua.win && obj.readyState != 4) {
>+ var newObj = createElement("div");
>+ replaceElemIdStr += "SWFObjectNew";
>+ newObj.setAttribute("id", replaceElemIdStr);
>+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div
>that will be replaced by the object element that loads expressinstall.swf
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ createSWF(att, par, replaceElemIdStr);
>+ }
>+ }
>+
>+ /* Functions to abstract and display alternative content
>+ */
>+ function displayAltContent(obj) {
>+ if (ua.ie && ua.win && obj.readyState != 4) {
>+ // IE only: when a SWF is loading (AND: not available in cache) wait
>for the readyState of the object element to become 4 before removing it,
>+ // because you cannot properly cancel a loading SWF file without
>breaking browser load references, also obj.onreadystatechange doesn't work
>+ var el = createElement("div");
>+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that
>will be replaced by the alternative content
>+ el.parentNode.replaceChild(abstractAltContent(obj), el);
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ else {
>+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
>+ }
>+ }
>+
>+ function abstractAltContent(obj) {
>+ var ac = createElement("div");
>+ if (ua.win && ua.ie) {
>+ ac.innerHTML = obj.innerHTML;
>+ }
>+ else {
>+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
>+ if (nestedObj) {
>+ var c = nestedObj.childNodes;
>+ if (c) {
>+ var cl = c.length;
>+ for (var i = 0; i < cl; i++) {
>+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") &&
>!(c[i].nodeType == 8)) {
>+ ac.appendChild(c[i].cloneNode(true));
>+ }
>+ }
>+ }
>+ }
>+ }
>+ return ac;
>+ }
>+
>+ /* Cross-browser dynamic SWF creation
>+ */
>+ function createSWF(attObj, parObj, id) {
>+ var r, el = getElementById(id);
>+ if (ua.wk && ua.wk < 312) { return r; }
>+ if (el) {
>+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the
>object element, it will inherit the 'id' from the alternative content
>+ attObj.id = id;
>+ }
>+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element
>+ W3C DOM methods do not combine: fall back to outerHTML
>+ var att = "";
>+ for (var i in attObj) {
>+ if (attObj[i] != Object.prototype[i]) { // filter out prototype
>additions from other potential libraries
>+ if (i.toLowerCase() == "data") {
>+ parObj.movie = attObj[i];
>+ }
>+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4
>reserved keyword
>+ att += ' class="' + attObj[i] + '"';
>+ }
>+ else if (i.toLowerCase() != "classid") {
>+ att += ' ' + i + '="' + attObj[i] + '"';
>+ }
>+ }
>+ }
>+ var par = "";
>+ for (var j in parObj) {
>+ if (parObj[j] != Object.prototype[j]) { // filter out prototype
>additions from other potential libraries
>+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
>+ }
>+ }
>+ el.outerHTML = '<object
>classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par +
>'</object>';
>+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object
>'leaks' on unload (dynamic publishing only)
>+ r = getElementById(attObj.id);
>+ }
>+ else { // well-behaving browsers
>+ var o = createElement(OBJECT);
>+ o.setAttribute("type", FLASH_MIME_TYPE);
>+ for (var m in attObj) {
>+ if (attObj[m] != Object.prototype[m]) { // filter out prototype
>additions from other potential libraries
>+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4
>reserved keyword
>+ o.setAttribute("class", attObj[m]);
>+ }
>+ else if (m.toLowerCase() != "classid") { // filter out IE specific
>attribute
>+ o.setAttribute(m, attObj[m]);
>+ }
>+ }
>+ }
>+ for (var n in parObj) {
>+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie")
>{ // filter out prototype additions from other potential libraries and IE
>specific param element
>+ createObjParam(o, n, parObj[n]);
>+ }
>+ }
>+ el.parentNode.replaceChild(o, el);
>+ r = o;
>+ }
>+ }
>+ return r;
>+ }
>+
>+ function createObjParam(el, pName, pValue) {
>+ var p = createElement("param");
>+ p.setAttribute("name", pName);
>+ p.setAttribute("value", pValue);
>+ el.appendChild(p);
>+ }
>+
>+ /* Cross-browser SWF removal
>+ - Especially needed to safely and completely remove a SWF in Internet
>Explorer
>+ */
>+ function removeSWF(id) {
>+ var obj = getElementById(id);
>+ if (obj && obj.nodeName == "OBJECT") {
>+ if (ua.ie && ua.win) {
>+ obj.style.display = "none";
>+ (function(){
>+ if (obj.readyState == 4) {
>+ removeObjectInIE(id);
>+ }
>+ else {
>+ setTimeout(arguments.callee, 10);
>+ }
>+ })();
>+ }
>+ else {
>+ obj.parentNode.removeChild(obj);
>+ }
>+ }
>+ }
>+
>+ function removeObjectInIE(id) {
>+ var obj = getElementById(id);
>+ if (obj) {
>+ for (var i in obj) {
>+ if (typeof obj[i] == "function") {
>+ obj[i] = null;
>+ }
>+ }
>+ obj.parentNode.removeChild(obj);
>+ }
>+ }
>+
>+ /* Functions to optimize JavaScript compression
>+ */
>+ function getElementById(id) {
>+ var el = null;
>+ try {
>+ el = doc.getElementById(id);
>+ }
>+ catch (e) {}
>+ return el;
>+ }
>+
>+ function createElement(el) {
>+ return doc.createElement(el);
>+ }
>+
>+ /* Updated attachEvent function for Internet Explorer
>+ - Stores attachEvent information in an Array, so on unload the
>detachEvent functions can be called to avoid memory leaks
>+ */
>+ function addListener(target, eventType, fn) {
>+ target.attachEvent(eventType, fn);
>+ listenersArr[listenersArr.length] = [target, eventType, fn];
>+ }
>+
>+ /* Flash Player and SWF content version matching
>+ */
>+ function hasPlayerVersion(rv) {
>+ var pv = ua.pv, v = rv.split(".");
>+ v[0] = parseInt(v[0], 10);
>+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9"
>instead of "9.0.0"
>+ v[2] = parseInt(v[2], 10) || 0;
>+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] ==
>v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
>+ }
>+
>+ /* Cross-browser dynamic CSS creation
>+ - Based on Bobby van der Sluis' solution:
>http://www.bobbyvandersluis.com/articles/dynamicCSS.php
>+ */
>+ function createCSS(sel, decl, media, newStyle) {
>+ if (ua.ie && ua.mac) { return; }
>+ var h = doc.getElementsByTagName("head")[0];
>+ if (!h) { return; } // to also support badly authored HTML pages that
>lack a head element
>+ var m = (media && typeof media == "string") ? media : "screen";
>+ if (newStyle) {
>+ dynamicStylesheet = null;
>+ dynamicStylesheetMedia = null;
>+ }
>+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
>+ // create dynamic stylesheet + get a global reference to it
>+ var s = createElement("style");
>+ s.setAttribute("type", "text/css");
>+ s.setAttribute("media", m);
>+ dynamicStylesheet = h.appendChild(s);
>+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF &&
>doc.styleSheets.length > 0) {
>+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
>+ }
>+ dynamicStylesheetMedia = m;
>+ }
>+ // add style rule
>+ if (ua.ie && ua.win) {
>+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
>+ dynamicStylesheet.addRule(sel, decl);
>+ }
>+ }
>+ else {
>+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
>+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl +
>"}"));
>+ }
>+ }
>+ }
>+
>+ function setVisibility(id, isVisible) {
>+ if (!autoHideShow) { return; }
>+ var v = isVisible ? "visible" : "hidden";
>+ if (isDomLoaded && getElementById(id)) {
>+ getElementById(id).style.visibility = v;
>+ }
>+ else {
>+ createCSS("#" + id, "visibility:" + v);
>+ }
>+ }
>+
>+ /* Filter to avoid XSS attacks
>+ */
>+ function urlEncodeIfNecessary(s) {
>+ var regex = /[\\\"<>\.;]/;
>+ var hasBadChars = regex.exec(s) != null;
>+ return hasBadChars && typeof encodeURIComponent != UNDEF ?
>encodeURIComponent(s) : s;
>+ }
>+
>+ /* Release memory to avoid memory leaks caused by closures, fix hanging
>audio/video threads and force open sockets/NetConnections to disconnect
>(Internet Explorer only)
>+ */
>+ var cleanup = function() {
>+ if (ua.ie && ua.win) {
>+ window.attachEvent("onunload", function() {
>+ // remove listeners to avoid memory leaks
>+ var ll = listenersArr.length;
>+ for (var i = 0; i < ll; i++) {
>+ listenersArr[i][0].detachEvent(listenersArr[i][1],
>listenersArr[i][2]);
>+ }
>+ // cleanup dynamically embedded objects to fix audio/video threads
>and force open sockets and NetConnections to disconnect
>+ var il = objIdArr.length;
>+ for (var j = 0; j < il; j++) {
>+ removeSWF(objIdArr[j]);
>+ }
>+ // cleanup library's main closures to avoid memory leaks
>+ for (var k in ua) {
>+ ua[k] = null;
>+ }
>+ ua = null;
>+ for (var l in swfobject) {
>+ swfobject[l] = null;
>+ }
>+ swfobject = null;
>+ });
>+ }
>+ }();
>+
>+ return {
>+ /* Public API
>+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
>+ */
>+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr,
>callbackFn) {
>+ if (ua.w3 && objectIdStr && swfVersionStr) {
>+ var regObj = {};
>+ regObj.id = objectIdStr;
>+ regObj.swfVersion = swfVersionStr;
>+ regObj.expressInstall = xiSwfUrlStr;
>+ regObj.callbackFn = callbackFn;
>+ regObjArr[regObjArr.length] = regObj;
>+ setVisibility(objectIdStr, false);
>+ }
>+ else if (callbackFn) {
>+ callbackFn({success:false, id:objectIdStr});
>+ }
>+ },
>+
>+ getObjectById: function(objectIdStr) {
>+ if (ua.w3) {
>+ return getObjectById(objectIdStr);
>+ }
>+ },
>+
>+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr,
>swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
>+ var callbackObj = {success:false, id:replaceElemIdStr};
>+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr
>&& widthStr && heightStr && swfVersionStr) {
>+ setVisibility(replaceElemIdStr, false);
>+ addDomLoadEvent(function() {
>+ widthStr += ""; // auto-convert to string
>+ heightStr += "";
>+ var att = {};
>+ if (attObj && typeof attObj === OBJECT) {
>+ for (var i in attObj) { // copy object to avoid the use of
>references, because web authors often reuse attObj for multiple SWFs
>+ att[i] = attObj[i];
>+ }
>+ }
>+ att.data = swfUrlStr;
>+ att.width = widthStr;
>+ att.height = heightStr;
>+ var par = {};
>+ if (parObj && typeof parObj === OBJECT) {
>+ for (var j in parObj) { // copy object to avoid the use of
>references, because web authors often reuse parObj for multiple SWFs
>+ par[j] = parObj[j];
>+ }
>+ }
>+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
>+ for (var k in flashvarsObj) { // copy object to avoid the use of
>references, because web authors often reuse flashvarsObj for multiple SWFs
>+ if (typeof par.flashvars != UNDEF) {
>+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
>+ }
>+ else {
>+ par.flashvars = k + "=" + flashvarsObj[k];
>+ }
>+ }
>+ }
>+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
>+ var obj = createSWF(att, par, replaceElemIdStr);
>+ if (att.id == replaceElemIdStr) {
>+ setVisibility(replaceElemIdStr, true);
>+ }
>+ callbackObj.success = true;
>+ callbackObj.ref = obj;
>+ }
>+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe
>Express Install
>+ att.data = xiSwfUrlStr;
>+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
>+ return;
>+ }
>+ else { // show alternative content
>+ setVisibility(replaceElemIdStr, true);
>+ }
>+ if (callbackFn) { callbackFn(callbackObj); }
>+ });
>+ }
>+ else if (callbackFn) { callbackFn(callbackObj); }
>+ },
>+
>+ switchOffAutoHideShow: function() {
>+ autoHideShow = false;
>+ },
>+
>+ ua: ua,
>+
>+ getFlashPlayerVersion: function() {
>+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
>+ },
>+
>+ hasFlashPlayerVersion: hasPlayerVersion,
>+
>+ createSWF: function(attObj, parObj, replaceElemIdStr) {
>+ if (ua.w3) {
>+ return createSWF(attObj, parObj, replaceElemIdStr);
>+ }
>+ else {
>+ return undefined;
>+ }
>+ },
>+
>+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
>+ if (ua.w3 && canExpressInstall()) {
>+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
>+ }
>+ },
>+
>+ removeSWF: function(objElemIdStr) {
>+ if (ua.w3) {
>+ removeSWF(objElemIdStr);
>+ }
>+ },
>+
>+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
>+ if (ua.w3) {
>+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
>+ }
>+ },
>+
>+ addDomLoadEvent: addDomLoadEvent,
>+
>+ addLoadEvent: addLoadEvent,
>+
>+ getQueryParamValue: function(param) {
>+ var q = doc.location.search || doc.location.hash;
>+ if (q) {
>+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
>+ if (param == null) {
>+ return urlEncodeIfNecessary(q);
>+ }
>+ var pairs = q.split("&");
>+ for (var i = 0; i < pairs.length; i++) {
>+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
>+ return
>urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
>+ }
>+ }
>+ }
>+ return "";
>+ },
>+
>+ // For internal usage only
>+ expressInstallCallback: function() {
>+ if (isExpressInstallActive) {
>+ var obj = getElementById(EXPRESS_INSTALL_ID);
>+ if (obj && storedAltContent) {
>+ obj.parentNode.replaceChild(storedAltContent, obj);
>+ if (storedAltContentId) {
>+ setVisibility(storedAltContentId, true);
>+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
>+ }
>+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
>+ }
>+ isExpressInstallActive = false;
>+ }
>+ }
>+ };
>+}();
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks-4.1.0.ja
>r
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar
>new file mode 100644
>index 0000000..e44ac0c
>Binary files /dev/null and
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/libs/flexUnitTasks
>-4.1.0.jar differ
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Training.mxml
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>new file mode 100644
>index 0000000..ab8a7db
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/FlexUnit4Train
>ing.mxml
>@@ -0,0 +1,50 @@
>+<?xml version="1.0" encoding="utf-8"?>
>+<!--
>+ Licensed to the Apache Software Foundation (ASF) under one or more
>+ contributor license agreements. See the NOTICE file distributed with
>+ this work for additional information regarding copyright ownership.
>+ The ASF licenses this file to You under the Apache License, Version 2.0
>+ (the "License"); you may not use this file except in compliance with
>+ the License. You may obtain a copy of the License at
>+
>+ http://www.apache.org/licenses/LICENSE-2.0
>+
>+ Unless required by applicable law or agreed to in writing, software
>+ distributed under the License is distributed on an "AS IS" BASIS,
>+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ See the License for the specific language governing permissions and
>+ limitations under the License.
>+-->
>+
>+<!-- This is an auto generated file and is not intended for
>modification. -->
>+
>+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>+ xmlns:s="library://ns.adobe.com/flex/spark"
>+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
>minHeight="600" xmlns:flexui="flexunit.flexui.*"
>creationComplete="onCreationComplete()">
>+ <fx:Script>
>+ <![CDATA[
>+ import math.testcases.BasicCircleTest;
>+
>+ import org.flexunit.runner.FlexUnitCore;
>+
>+ public function currentRunTestSuite():Array
>+ {
>+ var testsToRun:Array = new Array();
>+ testsToRun.push( BasicCircleTest );
>+ return testsToRun;
>+ }
>+
>+
>+ private function onCreationComplete():void
>+ {
>+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(),
>"FlexUnit4Training");
>+ }
>+
>+ ]]>
>+ </fx:Script>
>+ <fx:Declarations>
>+ <!-- Place non-visual elements (e.g., services, value objects) here -->
>+ </fx:Declarations>
>+
>+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
>+</s:Application>
>\ No newline at end of file
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalprimates/mat
>h/Circle.as
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>new file mode 100644
>index 0000000..5f4978a
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/src/net/digitalpri
>mates/math/Circle.as
>@@ -0,0 +1,131 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+package net.digitalprimates.math {
>+ import flash.geom.Point;
>+
>+ /**
>+ * Class to represent a mathematical circle in addition to
>circle-specific convenience methods.
>+ *
>+ * @author mlabriola
>+ *
>+ */
>+ public class Circle {
>+ /**
>+ * Constant representing the number of radians in a circle
>+ */
>+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
>+
>+ private var _origin:Point = new Point( 0, 0 );
>+ private var _radius:Number;
>+
>+ /**
>+ * Returns the circle's origin point as a
><code>flash.geom.Point</code> object.
>+ * The <code>origin</code> is a read only property supplied during
>the instantiation
>+ * of the Circle.
>+ *
>+ * @return The circle's origin point.
>+ *
>+ */
>+ public function get origin():Point {
>+ return _origin;
>+ }
>+
>+ /**
>+ * Returns the circle's radius as a <code>Number</code>.
>+ * The <code>radius</code> is a read only property supplied during
>the instantiation
>+ * of the Circle.
>+ *
>+ * @return The circle's radius.
>+ */
>+ public function get radius():Number {
>+ return _radius;
>+ }
>+
>+ /**
>+ * Returns the circle's diameter based on the <code>radius</code>
>property.
>+ * The <code>diameter</code> is a read only property.
>+ *
>+ * @see #radius
>+ * @return The circle's diameter.
>+ */
>+ public function get diameter():Number {
>+ return radius * 2;
>+ }
>+
>+ /**
>+ * Returns a point on the circle at a given radian offset.
>+ *
>+ * @param t radian position along the circle. 0 is the top-most point
>of the circle.
>+ * @return a Point object describing the cartesian coordinate of the
>point.
>+ *
>+ */
>+ public function getPointOnCircle( t:Number ):Point {
>+ var x:Number = origin.x + ( radius * Math.cos( t ) );
>+ var y:Number = origin.y + ( radius * Math.sin( t ) );
>+
>+ return new Point( x, y );
>+ }
>+
>+ /**
>+ *
>+ * Convenience method for converting radians to degrees.
>+ *
>+ * @param radians a radian offset from the top-most point of the
>circle.
>+ * @return a corresponding angle represented in degrees.
>+ *
>+ */
>+ public function radiansToDegrees( radians:Number ):Number {
>+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
>+ }
>+
>+ /**
>+ * Comparison method to determine circle equivalence (same center and
>radius).
>+ *
>+ * @param circle a circle for comparison
>+ * @return a boolean indicating if the circles are equivalent
>+ *
>+ */
>+ public function equals( circle:Circle ):Boolean {
>+ var equal:Boolean = false;
>+
>+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin
>) && ( circle.origin ) ) {
>+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y ==
>circle.origin.y ) ) {
>+ equal = true;
>+ }
>+ }
>+
>+ return equal;
>+ }
>+
>+ /**
>+ * Creates a new circle
>+ *
>+ * @param origin the origin point of the new circle
>+ * @param radius the radius of the new circle
>+ *
>+ */
>+ public function Circle( origin:Point, radius:Number ) {
>+
>+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
>+ throw new RangeError("Radius must be a positive Number");
>+ }
>+
>+ this._origin = origin;
>+ this._radius = radius;
>+ }
>+ }
>+}
>\ No newline at end of file
>
>http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/64592fdd/FlexUni
>t4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcases/BasicC
>ircleTest.as
>----------------------------------------------------------------------
>diff --git
>a/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>new file mode 100644
>index 0000000..f85bf23
>--- /dev/null
>+++
>b/FlexUnit4Tutorials/Unit4/startx/FlexUnit4Training_wt3/tests/math/testcas
>es/BasicCircleTest.as
>@@ -0,0 +1,94 @@
>+/*
>+ * Licensed to the Apache Software Foundation (ASF) under one or more
>+ * contributor license agreements. See the NOTICE file distributed with
>+ * this work for additional information regarding copyright ownership.
>+ * The ASF licenses this file to You under the Apache License, Version
>2.0
>+ * (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ *
>+ * http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ */
>+package math.testcases {
>+ import flash.geom.Point;
>+
>+ import net.digitalprimates.math.Circle;
>+
>+ import org.flexunit.asserts.assertEquals;
>+ import org.flexunit.asserts.assertFalse;
>+ import org.flexunit.asserts.assertTrue;
>+
>+ public class BasicCircleTest {
>+
>+ [Test]
>+ public function shouldReturnProvidedRadius():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 5, circle.radius );
>+ }
>+
>+ [Test]
>+ public function shouldComputeCorrectDiameter ():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 10, circle.diameter );
>+ }
>+
>+ [Test]
>+ public function shouldReturnProvidedOrigin():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ assertEquals( 0, circle.origin.x );
>+ assertEquals( 0, circle.origin.y );
>+ }
>+
>+ [Test]
>+ public function shouldReturnTrueForEqualCircle():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
>+
>+ assertTrue( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldReturnFalseForUnequalOrigin():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
>+
>+ assertFalse( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldReturnFalseForUnequalRadius():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
>+
>+ assertFalse( circle.equals( circle2 ) );
>+ }
>+
>+ [Test]
>+ public function shouldGetPointsOnCircle():void {
>+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
>+ var point:Point;
>+
>+ //top-most point of circle
>+ point = circle.getPointOnCircle( 0 );
>+ assertEquals( 5, point.x );
>+ assertEquals( 0, point.y );
>+
>+ //bottom-most point of circle
>+ point = circle.getPointOnCircle( Math.PI );
>+ assertEquals( -5, point.x );
>+ assertEquals( 0, point.y );
>+ }
>+
>+ [Test]
>+ public function shouldThrowRangeError():void {
>+
>+ }
>+
>+
>+ }
>+}
>\ No newline at end of file
>
[47/50] [abbrv] git commit: [flex-flexunit] [refs/heads/develop] -
Merge branch 'refs/heads/FlexUnitTutorial' into FlexUnitTutorial2
Posted by jm...@apache.org.
Merge branch 'refs/heads/FlexUnitTutorial' into FlexUnitTutorial2
Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/9b92b2f8
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/9b92b2f8
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/9b92b2f8
Branch: refs/heads/develop
Commit: 9b92b2f8be6c9752dde346e9f4e17e60fdd4bebd
Parents: cd1333a 68f0bd3
Author: cyrillzadra <cy...@gmail.com>
Authored: Sun Sep 15 23:38:59 2013 +0200
Committer: cyrillzadra <cy...@gmail.com>
Committed: Sun Sep 15 23:38:59 2013 +0200
----------------------------------------------------------------------
FlexUnit4AntTasks/build.xml | 32 +-
FlexUnit4FlexCoverListener/build.xml | 32 +-
FlexUnit4Test/build.xml | 32 +-
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Complete/FlexUnit4Training/.flexProperties | 18 +
.../Complete/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/Complete/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/Complete/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training/.flexProperties | 18 +
.../Start/FlexUnit4Training/.fxpProperties | 32 +
.../Unit1/Start/FlexUnit4Training/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Unit1/Start/FlexUnit4Training/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/SampleCircleLayout.mxml | 35 +
.../Start/FlexUnit4Training/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../Start/FlexUnit4Training/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../Start/FlexUnit4Training/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../Start/FlexUnit4Training/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../Start/FlexUnit4Training/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/math/Donut.as | 40 +
.../digitalprimates/math/layout/CircleLayout.as | 80 ++
.../tests/math/testcases/BasicCircleTest.as | 85 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 136 ++++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 39 +
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 136 ++++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 52 ++
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 59 ++
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt4/.flexProperties | 18 +
.../FlexUnit4Training_wt4/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt4/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 29 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../FlexUnit4Training_wt4/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit10/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit10/Start/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 136 ++++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 39 +
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit10/Start/FlexUnit4Training_wt3/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 136 ++++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 52 ++
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt4/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt4/.fxpProperties | 32 +
.../Unit10/Start/FlexUnit4Training_wt4/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 28 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt4/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 45 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 62 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit11/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 29 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit11/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 52 ++
.../tests/math/testcases/GetPointsTest.as | 45 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit11/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 62 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit12/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../components/layout/CircleLayout.as | 80 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/xml/circlePoints.xml | 76 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 26 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 28 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 28 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../async/testcases/ServiceSequenceTest.as | 63 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit13/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit13/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 26 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit13/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 28 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt3/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../async/testcases/ServiceSequenceTest.as | 64 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 58 ++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../async/testcases/ServiceSequenceTest.as | 64 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 105 +++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit14/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../async/testcases/ServiceSequenceTest.as | 64 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 77 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 30 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit14/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 62 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 74 ++
.../async/testcases/ServiceSequenceTest.as | 64 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 58 ++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt1/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt1/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt1/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt1/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt1/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 87 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 105 +++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt2/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt2/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt2/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt2/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt2/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 87 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 137 ++++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 105 +++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit15/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt1/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt1/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt1/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt1/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt1/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 105 +++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit15/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt2/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt2/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt2/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt2/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt2/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 87 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 78 ++
.../tests/login/testcases/LoginStartupTest.as | 105 +++
.../tests/login/testcases/LoginSuite.as | 25 +
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Complete/FlexUnit4Training_wt1/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../FlexUnit4Training_wt1/libs/build.xml | 104 +++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 54 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt1/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt1/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt1/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt1/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt1/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 73 ++
.../tests/login/testcases/LoginSuite.as | 26 +
.../tests/login/testcases/LoginTest.as | 103 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Complete/FlexUnit4Training_wt2/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../FlexUnit4Training_wt2/libs/build.xml | 104 +++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 54 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt2/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt2/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt2/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt2/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt2/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 73 ++
.../tests/login/testcases/LoginSuite.as | 26 +
.../tests/login/testcases/LoginTest.as | 103 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
FlexUnit4Tutorials/Unit16/FlexUnitCI/Ant.zip | Bin 0 -> 10835815 bytes
.../Unit16/FlexUnitCI/TestSwf.swf | Bin 0 -> 72713 bytes
FlexUnit4Tutorials/Unit16/FlexUnitCI/build.xml | 104 +++
.../FlexUnitCI/flashplayer_10_sa_debug.app.zip | Bin 0 -> 9038990 bytes
.../FlexUnitCI/flashplayer_10_sa_debug.exe | Bin 0 -> 6541264 bytes
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit16/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Start/FlexUnit4Training_wt1/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../Start/FlexUnit4Training_wt1/libs/build.xml | 104 +++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 50 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt1/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt1/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt1/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt1/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt1/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 73 ++
.../tests/login/testcases/LoginSuite.as | 26 +
.../tests/login/testcases/LoginTest.as | 103 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit16/Start/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../Start/FlexUnit4Training_wt2/build.xml | 104 +++
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../Start/FlexUnit4Training_wt2/libs/build.xml | 104 +++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 54 ++
.../src/SampleCircleLayout.mxml | 35 +
.../FlexUnit4Training_wt2/src/assets/1.jpg | Bin 0 -> 16146 bytes
.../FlexUnit4Training_wt2/src/assets/2.jpg | Bin 0 -> 13636 bytes
.../FlexUnit4Training_wt2/src/assets/3.jpg | Bin 0 -> 9528 bytes
.../FlexUnit4Training_wt2/src/assets/4.jpg | Bin 0 -> 11967 bytes
.../FlexUnit4Training_wt2/src/assets/5.jpg | Bin 0 -> 11536 bytes
.../async/PrimeNumberGenerator.as | 84 ++
.../components/layout/CircleLayout.as | 80 ++
.../components/login/LoginComponent.mxml | 74 ++
.../event/PrimeGeneratorEvent.as | 35 +
.../digitalprimates/event/StubServiceEvent.as | 33 +
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../src/net/digitalprimates/stub/ServiceStub.as | 91 +++
.../tests/async/testcases/AsyncSuite.as | 27 +
.../tests/async/testcases/BasicTimerTest.as | 66 ++
.../async/testcases/PrimeNumberGeneratorTest.as | 75 ++
.../async/testcases/ServiceSequenceTest.as | 71 ++
.../tests/fu1/TestAssert.as | 563 +++++++++++++
.../tests/helper/GetPointsDataHelper.as | 75 ++
.../tests/helper/NumberDataHelper.as | 75 ++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/helper/UserAndPasswordDataHelper.as | 73 ++
.../tests/login/testcases/LoginSuite.as | 26 +
.../tests/login/testcases/LoginTest.as | 103 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleMockTest.as | 60 ++
.../tests/math/testcases/CircleSuite.as | 30 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../tests/math/testcases/DistanceTest.as | 51 ++
.../tests/math/testcases/GetPointsTest.as | 64 ++
.../tests/testcases/AllSuites.as | 34 +
.../tests/xml/circlePoints.xml | 76 ++
.../tests/xml/numberList.xml | 39 +
.../FlexUnit4Training_wt2/tests/xml/radii.xml | 30 +
.../tests/xml/usersAndPasswords.xml | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit2/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 22 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 33 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 84 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit4/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../libs/flexUnitTasks-4.1.0.jar | Bin 0 -> 592892 bytes
.../src/FlexUnit4Training.mxml | 50 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 94 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 118 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 123 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 115 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt4/.flexProperties | 18 +
.../FlexUnit4Training_wt4/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt4/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 48 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 45 ++
.../tests/math/testcases/BasicCircleTest.as | 115 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit5/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit5/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 118 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit5/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 47 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/math/testcases/BasicCircleTest.as | 123 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt4/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt4/.fxpProperties | 32 +
.../Unit5/Start/FlexUnit4Training_wt4/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 45 ++
.../tests/math/testcases/BasicCircleTest.as | 115 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 45 ++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 45 ++
.../tests/math/testcases/BasicCircleTest.as | 137 ++++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit6/Start/FlexUnit4Training_wt1/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit6/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 45 ++
.../tests/math/testcases/BasicCircleTest.as | 114 +++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 26 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit7/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 139 ++++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit7/Start/FlexUnit4Training_wt2/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 42 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt2/.flexProperties | 18 +
.../FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 45 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt3/.flexProperties | 18 +
.../FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 69 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit8/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 26 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt2/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt2/.fxpProperties | 32 +
.../Unit8/Start/FlexUnit4Training_wt2/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 42 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt3/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt3/.fxpProperties | 32 +
.../Unit8/Start/FlexUnit4Training_wt3/.project | 35 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 45 ++
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../FlexUnit4Training_wt1/.flexProperties | 18 +
.../FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Complete/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 73 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
.../FlexUnitApplicationLastRun.xml | 22 +
.../FlexUnitApplicationLastSelection.xml | 22 +
.../Start/FlexUnit4Training_wt1/.flexProperties | 18 +
.../Start/FlexUnit4Training_wt1/.fxpProperties | 32 +
.../Unit9/Start/FlexUnit4Training_wt1/.project | 34 +
.../.settings/org.eclipse.core.resources.prefs | 18 +
.../html-template/history/history.css | 22 +
.../html-template/history/history.js | 726 +++++++++++++++++
.../html-template/history/historyFrame.html | 45 ++
.../html-template/index.template.html | 121 +++
.../html-template/playerProductInstall.swf | Bin 0 -> 657 bytes
.../html-template/swfobject.js | 793 +++++++++++++++++++
.../src/FlexUnit4Training.mxml | 45 ++
.../src/net/digitalprimates/math/Circle.as | 131 +++
.../tests/helper/RadiiDataHelper.as | 64 ++
.../tests/matcher/CloseToPointMatcher.as | 46 ++
.../tests/math/testcases/BasicCircleTest.as | 133 ++++
.../math/testcases/CircleConstructorTest.as | 31 +
.../tests/math/testcases/CircleSuite.as | 27 +
.../tests/math/testcases/CircleTheory.as | 69 ++
.../FlexUnit4Training_wt1/tests/xml/radii.xml | 30 +
README | 1 -
1792 files changed, 196314 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
[43/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/swfobject.js b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/swfobject.js
new file mode 100644
index 0000000..c862aae
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/html-template/swfobject.js
@@ -0,0 +1,793 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/FlexUnit4Training.mxml
new file mode 100644
index 0000000..bccbb82
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/FlexUnit4Training.mxml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import math.testcases.BasicCircleTest;
+
+ public function currentRunTestSuite():Array
+ {
+ var testsToRun:Array = new Array();
+ testsToRun.push( BasicCircleTest );
+ return testsToRun;
+ }
+
+
+ private function onCreationComplete():void
+ {
+ testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+
+ <flexui:FlexUnitTestRunnerUI id="testRunner"/>
+</s:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
new file mode 100644
index 0000000..52022dc
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/src/net/digitalprimates/math/Donut.as
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math
+{
+ import flash.geom.Point;
+
+ public class Donut extends Circle
+ {
+ public static const DONUT_RADIUS_RATIO:Number = 0.2;
+
+ private var _innerRadius:Number;
+
+ public function Donut( origin:Point, radius:Number )
+ {
+ super( origin, radius );
+
+ _innerRadius = radius * DONUT_RADIUS_RATIO;
+ }
+
+ public function get innerRadius():Number
+ {
+ return _innerRadius;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..d8724d9
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Complete/FlexUnit4Training/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+ [Test]
+ public function shouldGetEqualRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Radius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function get_Diameter():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function get_origin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function test_equals():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle3:Circle = new Circle( new Point( 0, 0 ), 10 );
+ var circle4:Circle = new Circle( new Point( 10, 10 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ assertFalse( circle.equals( circle3 ) );
+ assertFalse( circle.equals( circle4 ) );
+ }
+
+ /*[Test]
+ public function test_getPointOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+ */
+ /*[Test]
+ public function test_constructor():void {
+ var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+ }*/
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
new file mode 100644
index 0000000..b85054b
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<testrun name="" >
+<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
+<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
+</testsuite>
+</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.flexProperties b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.flexProperties
new file mode 100644
index 0000000..d6472fe
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.flexProperties
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.fxpProperties b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.fxpProperties
new file mode 100644
index 0000000..85b29aa
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.fxpProperties
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240" version="4">
+ <projects/>
+ <src>
+ <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
+ </src>
+ <swc>
+ <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="611dbd02-bf02-4fe1-811d-24bda7742240"/>
+ <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
+ </swc>
+ <misc/>
+ <theme/>
+</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.project b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.project
new file mode 100644
index 0000000..b9587a7
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectDescription>
+ <name>FlexUnit4Training</name>
+ <comment/>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+ </natures>
+</projectDescription>
+
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..91af8ec
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Wed Jun 09 10:59:48 CDT 2010
+eclipse.preferences.version=1
+encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/build.xml b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/build.xml
new file mode 100644
index 0000000..f6e02ba
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/build.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ This build file is intended as a simple example for FlexUnit4Training.
+
+ The end goal is to produce a zip of a website you could deploy for your application. This build is not intended to be an example
+ for how to use Ant or the Flex SDK Ant tasks. This is just one possible way to utilize the FlexUnit4 Ant task.
+ -->
+<project name="FlexUnit4SampleProject" basedir="." default="package">
+ <!-- setup a prefix for all environment variables -->
+ <property environment="env" />
+
+ <!-- Setup paths for build -->
+ <property name="main.src.loc" location="${basedir}/src/" />
+ <property name="test.src.loc" location="${basedir}/src/flexUnitTests/" />
+ <property name="lib.loc" location="${basedir}/libs" />
+ <property name="output.loc" location="${basedir}/target" />
+ <property name="bin.loc" location="${output.loc}/bin" />
+ <property name="report.loc" location="${output.loc}/report" />
+ <property name="dist.loc" location="${output.loc}/dist" />
+
+ <!-- Setup Flex and FlexUnit ant tasks -->
+ <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
+ <property name="FLEX_HOME" location="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.1.0/" />
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.1.0.jar" />
+
+ <target name="clean">
+ <!-- Remove all directories created during the build process -->
+ <delete dir="${output.loc}" />
+ </target>
+
+ <target name="init">
+ <!-- Create directories needed for the build process -->
+ <mkdir dir="${output.loc}" />
+ <mkdir dir="${bin.loc}" />
+ <mkdir dir="${report.loc}" />
+ <mkdir dir="${dist.loc}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <!-- Compile Main.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/Main.mxml" output="${bin.loc}/Main.swf">
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+ </target>
+
+ <target name="test" depends="init">
+ <!-- Compile TestRunner.mxml as a SWF -->
+ <mxmlc file="${main.src.loc}/FlexUnit4Training.mxml" output="${bin.loc}/FlexUnit4Training.swf">
+ <source-path path-element="${main.src.loc}" />
+ <library-path dir="${lib.loc}" append="true">
+ <include name="*.swc" />
+ </library-path>
+ <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
+ <compiler.headless-server>true</compiler.headless-server>
+ </mxmlc>
+
+ <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
+ <flexunit swf="${bin.loc}/FlexUnit4Training.swf"
+ toDir="${report.loc}"
+ haltonfailure="false"
+ verbose="true"
+ localTrusted="true" />
+
+ <!-- Generate readable JUnit-style reports -->
+ <junitreport todir="${report.loc}">
+ <fileset dir="${report.loc}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${report.loc}/html" />
+ </junitreport>
+ </target>
+
+ <target name="package" depends="test">
+ <!-- Assemble final website -->
+ <copy file="${bin.loc}/FlexUnit4Training.swf" todir="${dist.loc}" />
+ <html-wrapper swf="Main" output="${dist.loc}" height="100%" width="100%" />
+
+ <!-- Zip up final website -->
+ <zip destfile="${output.loc}/${ant.project.name}.zip">
+ <fileset dir="${dist.loc}" />
+ </zip>
+ </target>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.css b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.css
new file mode 100644
index 0000000..8716330
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
+
+#ie_historyFrame { width: 0px; height: 0px; display:none }
+#firefox_anchorDiv { width: 0px; height: 0px; display:none }
+#safari_formDiv { width: 0px; height: 0px; display:none }
+#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.js b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.js
new file mode 100644
index 0000000..61b46f2
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/history.js
@@ -0,0 +1,726 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+BrowserHistoryUtils = {
+ addEvent: function(elm, evType, fn, useCapture) {
+ useCapture = useCapture || false;
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ }
+ else if (elm.attachEvent) {
+ var r = elm.attachEvent('on' + evType, fn);
+ return r;
+ }
+ else {
+ elm['on' + evType] = fn;
+ }
+ }
+}
+
+BrowserHistory = (function() {
+ // type of browser
+ var browser = {
+ ie: false,
+ ie8: false,
+ firefox: false,
+ safari: false,
+ opera: false,
+ version: -1
+ };
+
+ // if setDefaultURL has been called, our first clue
+ // that the SWF is ready and listening
+ //var swfReady = false;
+
+ // the URL we'll send to the SWF once it is ready
+ //var pendingURL = '';
+
+ // Default app state URL to use when no fragment ID present
+ var defaultHash = '';
+
+ // Last-known app state URL
+ var currentHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHref = document.location.href;
+
+ // Initial URL (used only by IE)
+ var initialHash = document.location.hash;
+
+ // History frame source URL prefix (used only by IE)
+ var historyFrameSourcePrefix = 'history/historyFrame.html?';
+
+ // History maintenance (used only by Safari)
+ var currentHistoryLength = -1;
+
+ var historyHash = [];
+
+ var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
+
+ var backStack = [];
+ var forwardStack = [];
+
+ var currentObjectId = null;
+
+ //UserAgent detection
+ var useragent = navigator.userAgent.toLowerCase();
+
+ if (useragent.indexOf("opera") != -1) {
+ browser.opera = true;
+ } else if (useragent.indexOf("msie") != -1) {
+ browser.ie = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
+ if (browser.version == 8)
+ {
+ browser.ie = false;
+ browser.ie8 = true;
+ }
+ } else if (useragent.indexOf("safari") != -1) {
+ browser.safari = true;
+ browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
+ } else if (useragent.indexOf("gecko") != -1) {
+ browser.firefox = true;
+ }
+
+ if (browser.ie == true && browser.version == 7) {
+ window["_ie_firstload"] = false;
+ }
+
+ function hashChangeHandler()
+ {
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+
+ // Accessor functions for obtaining specific elements of the page.
+ function getHistoryFrame()
+ {
+ return document.getElementById('ie_historyFrame');
+ }
+
+ function getAnchorElement()
+ {
+ return document.getElementById('firefox_anchorDiv');
+ }
+
+ function getFormElement()
+ {
+ return document.getElementById('safari_formDiv');
+ }
+
+ function getRememberElement()
+ {
+ return document.getElementById("safari_remember_field");
+ }
+
+ // Get the Flash player object for performing ExternalInterface callbacks.
+ // Updated for changes to SWFObject2.
+ function getPlayer(id) {
+ var i;
+
+ if (id && document.getElementById(id)) {
+ var r = document.getElementById(id);
+ if (typeof r.SetVariable != "undefined") {
+ return r;
+ }
+ else {
+ var o = r.getElementsByTagName("object");
+ var e = r.getElementsByTagName("embed");
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ return o[i];
+ }
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ return e[i];
+ }
+ }
+ }
+ else {
+ var o = document.getElementsByTagName("object");
+ var e = document.getElementsByTagName("embed");
+ for (i = 0; i < e.length; i++) {
+ if (typeof e[i].browserURLChange != "undefined")
+ {
+ return e[i];
+ }
+ }
+ for (i = 0; i < o.length; i++) {
+ if (typeof o[i].browserURLChange != "undefined")
+ {
+ return o[i];
+ }
+ }
+ }
+ return undefined;
+ }
+
+ function getPlayers() {
+ var i;
+ var players = [];
+ if (players.length == 0) {
+ var tmp = document.getElementsByTagName('object');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ if (players.length == 0 || players[0].object == null) {
+ var tmp = document.getElementsByTagName('embed');
+ for (i = 0; i < tmp.length; i++)
+ {
+ if (typeof tmp[i].browserURLChange != "undefined")
+ players.push(tmp[i]);
+ }
+ }
+ return players;
+ }
+
+ function getIframeHash() {
+ var doc = getHistoryFrame().contentWindow.document;
+ var hash = String(doc.location.search);
+ if (hash.length == 1 && hash.charAt(0) == "?") {
+ hash = "";
+ }
+ else if (hash.length >= 2 && hash.charAt(0) == "?") {
+ hash = hash.substring(1);
+ }
+ return hash;
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function getHash() {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ var idx = document.location.href.indexOf('#');
+ return (idx >= 0) ? document.location.href.substr(idx+1) : '';
+ }
+
+ /* Get the current location hash excluding the '#' symbol. */
+ function setHash(hash) {
+ // It would be nice if we could use document.location.hash here,
+ // but it's faulty sometimes.
+ if (hash == '') hash = '#'
+ document.location.hash = hash;
+ }
+
+ function createState(baseUrl, newUrl, flexAppUrl) {
+ return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
+ }
+
+ /* Add a history entry to the browser.
+ * baseUrl: the portion of the location prior to the '#'
+ * newUrl: the entire new URL, including '#' and following fragment
+ * flexAppUrl: the portion of the location following the '#' only
+ */
+ function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
+
+ //delete all the history entries
+ forwardStack = [];
+
+ if (browser.ie) {
+ //Check to see if we are being asked to do a navigate for the first
+ //history entry, and if so ignore, because it's coming from the creation
+ //of the history iframe
+ if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
+ currentHref = initialHref;
+ return;
+ }
+ if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
+ newUrl = baseUrl + '#' + defaultHash;
+ flexAppUrl = defaultHash;
+ } else {
+ // for IE, tell the history frame to go somewhere without a '#'
+ // in order to get this entry into the browser history.
+ getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
+ }
+ setHash(flexAppUrl);
+ } else {
+
+ //ADR
+ if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
+ initialState = createState(baseUrl, newUrl, flexAppUrl);
+ } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
+ backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
+ }
+
+ if (browser.safari) {
+ // for Safari, submit a form whose action points to the desired URL
+ if (browser.version <= 419.3) {
+ var file = window.location.pathname.toString();
+ file = file.substring(file.lastIndexOf("/")+1);
+ getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
+ //get the current elements and add them to the form
+ var qs = window.location.search.substring(1);
+ var qs_arr = qs.split("&");
+ for (var i = 0; i < qs_arr.length; i++) {
+ var tmp = qs_arr[i].split("=");
+ var elem = document.createElement("input");
+ elem.type = "hidden";
+ elem.name = tmp[0];
+ elem.value = tmp[1];
+ document.forms.historyForm.appendChild(elem);
+ }
+ document.forms.historyForm.submit();
+ } else {
+ top.location.hash = flexAppUrl;
+ }
+ // We also have to maintain the history by hand for Safari
+ historyHash[history.length] = flexAppUrl;
+ _storeStates();
+ } else {
+ // Otherwise, write an anchor into the page and tell the browser to go there
+ addAnchor(flexAppUrl);
+ setHash(flexAppUrl);
+
+ // For IE8 we must restore full focus/activation to our invoking player instance.
+ if (browser.ie8)
+ getPlayer().focus();
+ }
+ }
+ backStack.push(createState(baseUrl, newUrl, flexAppUrl));
+ }
+
+ function _storeStates() {
+ if (browser.safari) {
+ getRememberElement().value = historyHash.join(",");
+ }
+ }
+
+ function handleBackButton() {
+ //The "current" page is always at the top of the history stack.
+ var current = backStack.pop();
+ if (!current) { return; }
+ var last = backStack[backStack.length - 1];
+ if (!last && backStack.length == 0){
+ last = initialState;
+ }
+ forwardStack.push(current);
+ }
+
+ function handleForwardButton() {
+ //summary: private method. Do not call this directly.
+
+ var last = forwardStack.pop();
+ if (!last) { return; }
+ backStack.push(last);
+ }
+
+ function handleArbitraryUrl() {
+ //delete all the history entries
+ forwardStack = [];
+ }
+
+ /* Called periodically to poll to see if we need to detect navigation that has occurred */
+ function checkForUrlChange() {
+
+ if (browser.ie) {
+ if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
+ //This occurs when the user has navigated to a specific URL
+ //within the app, and didn't use browser back/forward
+ //IE seems to have a bug where it stops updating the URL it
+ //shows the end-user at this point, but programatically it
+ //appears to be correct. Do a full app reload to get around
+ //this issue.
+ if (browser.version < 7) {
+ currentHref = document.location.href;
+ document.location.reload();
+ } else {
+ if (getHash() != getIframeHash()) {
+ // this.iframe.src = this.blankURL + hash;
+ var sourceToSet = historyFrameSourcePrefix + getHash();
+ getHistoryFrame().src = sourceToSet;
+ currentHref = document.location.href;
+ }
+ }
+ }
+ }
+
+ if (browser.safari) {
+ // For Safari, we have to check to see if history.length changed.
+ if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
+ //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
+ var flexAppUrl = getHash();
+ if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
+ {
+ // If it did change and we're running Safari 3.x or earlier,
+ // then we have to look the old state up in our hand-maintained
+ // array since document.location.hash won't have changed,
+ // then call back into BrowserManager.
+ currentHistoryLength = history.length;
+ flexAppUrl = historyHash[currentHistoryLength];
+ }
+
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ _storeStates();
+ }
+ }
+ if (browser.firefox) {
+ if (currentHref != document.location.href) {
+ var bsl = backStack.length;
+
+ var urlActions = {
+ back: false,
+ forward: false,
+ set: false
+ }
+
+ if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
+ urlActions.back = true;
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ handleBackButton();
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if (forwardStack.length > 0) {
+ if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
+ urlActions.forward = true;
+ handleForwardButton();
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if ((bsl >= 2) && (backStack[bsl - 2])) {
+ if (backStack[bsl - 2].flexAppUrl == getHash()) {
+ urlActions.back = true;
+ handleBackButton();
+ }
+ }
+
+ if (!urlActions.back && !urlActions.forward) {
+ var foundInStacks = {
+ back: -1,
+ forward: -1
+ }
+
+ for (var i = 0; i < backStack.length; i++) {
+ if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.back = i;
+ }
+ }
+ for (var i = 0; i < forwardStack.length; i++) {
+ if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
+ arbitraryUrl = true;
+ foundInStacks.forward = i;
+ }
+ }
+ handleArbitraryUrl();
+ }
+
+ // Firefox changed; do a callback into BrowserManager to tell it.
+ currentHref = document.location.href;
+ var flexAppUrl = getHash();
+ //ADR: to fix multiple
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ pl[i].browserURLChange(flexAppUrl);
+ }
+ } else {
+ getPlayer().browserURLChange(flexAppUrl);
+ }
+ }
+ }
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
+ function addAnchor(flexAppUrl)
+ {
+ if (document.getElementsByName(flexAppUrl).length == 0) {
+ getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
+ }
+ }
+
+ var _initialize = function () {
+ if (browser.ie)
+ {
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
+ }
+ }
+ historyFrameSourcePrefix = iframe_location + "?";
+ var src = historyFrameSourcePrefix;
+
+ var iframe = document.createElement("iframe");
+ iframe.id = 'ie_historyFrame';
+ iframe.name = 'ie_historyFrame';
+ iframe.src = 'javascript:false;';
+
+ try {
+ document.body.appendChild(iframe);
+ } catch(e) {
+ setTimeout(function() {
+ document.body.appendChild(iframe);
+ }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ var rememberDiv = document.createElement("div");
+ rememberDiv.id = 'safari_rememberDiv';
+ document.body.appendChild(rememberDiv);
+ rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
+
+ var formDiv = document.createElement("div");
+ formDiv.id = 'safari_formDiv';
+ document.body.appendChild(formDiv);
+
+ var reloader_content = document.createElement('div');
+ reloader_content.id = 'safarireloader';
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0, s; s = scripts[i]; i++) {
+ if (s.src.indexOf("history.js") > -1) {
+ html = (new String(s.src)).replace(".js", ".html");
+ }
+ }
+ reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
+ document.body.appendChild(reloader_content);
+ reloader_content.style.position = 'absolute';
+ reloader_content.style.left = reloader_content.style.top = '-9999px';
+ iframe = reloader_content.getElementsByTagName('iframe')[0];
+
+ if (document.getElementById("safari_remember_field").value != "" ) {
+ historyHash = document.getElementById("safari_remember_field").value.split(",");
+ }
+
+ }
+
+ if (browser.firefox || browser.ie8)
+ {
+ var anchorDiv = document.createElement("div");
+ anchorDiv.id = 'firefox_anchorDiv';
+ document.body.appendChild(anchorDiv);
+ }
+
+ if (browser.ie8)
+ document.body.onhashchange = hashChangeHandler;
+ //setTimeout(checkForUrlChange, 50);
+ }
+
+ return {
+ historyHash: historyHash,
+ backStack: function() { return backStack; },
+ forwardStack: function() { return forwardStack },
+ getPlayer: getPlayer,
+ initialize: function(src) {
+ _initialize(src);
+ },
+ setURL: function(url) {
+ document.location.href = url;
+ },
+ getURL: function() {
+ return document.location.href;
+ },
+ getTitle: function() {
+ return document.title;
+ },
+ setTitle: function(title) {
+ try {
+ backStack[backStack.length - 1].title = title;
+ } catch(e) { }
+ //if on safari, set the title to be the empty string.
+ if (browser.safari) {
+ if (title == "") {
+ try {
+ var tmp = window.location.href.toString();
+ title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
+ } catch(e) {
+ title = "";
+ }
+ }
+ }
+ document.title = title;
+ },
+ setDefaultURL: function(def)
+ {
+ defaultHash = def;
+ def = getHash();
+ //trailing ? is important else an extra frame gets added to the history
+ //when navigating back to the first page. Alternatively could check
+ //in history frame navigation to compare # and ?.
+ if (browser.ie)
+ {
+ window['_ie_firstload'] = true;
+ var sourceToSet = historyFrameSourcePrefix + def;
+ var func = function() {
+ getHistoryFrame().src = sourceToSet;
+ window.location.replace("#" + def);
+ setInterval(checkForUrlChange, 50);
+ }
+ try {
+ func();
+ } catch(e) {
+ window.setTimeout(function() { func(); }, 0);
+ }
+ }
+
+ if (browser.safari)
+ {
+ currentHistoryLength = history.length;
+ if (historyHash.length == 0) {
+ historyHash[currentHistoryLength] = def;
+ var newloc = "#" + def;
+ window.location.replace(newloc);
+ } else {
+ //alert(historyHash[historyHash.length-1]);
+ }
+ //setHash(def);
+ setInterval(checkForUrlChange, 50);
+ }
+
+
+ if (browser.firefox || browser.opera)
+ {
+ var reg = new RegExp("#" + def + "$");
+ if (window.location.toString().match(reg)) {
+ } else {
+ var newloc ="#" + def;
+ window.location.replace(newloc);
+ }
+ setInterval(checkForUrlChange, 50);
+ //setHash(def);
+ }
+
+ },
+
+ /* Set the current browser URL; called from inside BrowserManager to propagate
+ * the application state out to the container.
+ */
+ setBrowserURL: function(flexAppUrl, objectId) {
+ if (browser.ie && typeof objectId != "undefined") {
+ currentObjectId = objectId;
+ }
+ //fromIframe = fromIframe || false;
+ //fromFlex = fromFlex || false;
+ //alert("setBrowserURL: " + flexAppUrl);
+ //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
+
+ var pos = document.location.href.indexOf('#');
+ var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
+ var newUrl = baseUrl + '#' + flexAppUrl;
+
+ if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
+ currentHref = newUrl;
+ addHistoryEntry(baseUrl, newUrl, flexAppUrl);
+ currentHistoryLength = history.length;
+ }
+ },
+
+ browserURLChange: function(flexAppUrl) {
+ var objectId = null;
+ if (browser.ie && currentObjectId != null) {
+ objectId = currentObjectId;
+ }
+ pendingURL = '';
+
+ if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
+ var pl = getPlayers();
+ for (var i = 0; i < pl.length; i++) {
+ try {
+ pl[i].browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+ } else {
+ try {
+ getPlayer(objectId).browserURLChange(flexAppUrl);
+ } catch(e) { }
+ }
+
+ currentObjectId = null;
+ },
+ getUserAgent: function() {
+ return navigator.userAgent;
+ },
+ getPlatform: function() {
+ return navigator.platform;
+ }
+
+ }
+
+})();
+
+// Initialization
+
+// Automated unit testing and other diagnostics
+
+function setURL(url)
+{
+ document.location.href = url;
+}
+
+function backButton()
+{
+ history.back();
+}
+
+function forwardButton()
+{
+ history.forward();
+}
+
+function goForwardOrBackInHistory(step)
+{
+ history.go(step);
+}
+
+//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
+(function(i) {
+ var u =navigator.userAgent;var e=/*@cc_on!@*/false;
+ var st = setTimeout;
+ if(/webkit/i.test(u)){
+ st(function(){
+ var dr=document.readyState;
+ if(dr=="loaded"||dr=="complete"){i()}
+ else{st(arguments.callee,10);}},10);
+ } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
+ document.addEventListener("DOMContentLoaded",i,false);
+ } else if(e){
+ (function(){
+ var t=document.createElement('doc:rdy');
+ try{t.doScroll('left');
+ i();t=null;
+ }catch(e){st(arguments.callee,0);}})();
+ } else{
+ window.onload=i;
+ }
+})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/historyFrame.html
new file mode 100644
index 0000000..c8af338
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit1/Start/FlexUnit4Training/html-template/history/historyFrame.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
+ </head>
+ <body>
+ <script>
+ function processUrl()
+ {
+
+ var pos = url.indexOf("?");
+ url = pos != -1 ? url.substr(pos + 1) : "";
+ if (!parent._ie_firstload) {
+ parent.BrowserHistory.setBrowserURL(url);
+ try {
+ parent.BrowserHistory.browserURLChange(url);
+ } catch(e) { }
+ } else {
+ parent._ie_firstload = false;
+ }
+ }
+
+ var url = document.location.href;
+ processUrl();
+ document.write(encodeURIComponent(url));
+ </script>
+ Hidden frame for Browser History support.
+ </body>
+</html>
[29/50] [abbrv] rename folder
Posted by jm...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
new file mode 100644
index 0000000..5f4978a
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/src/net/digitalprimates/math/Circle.as
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.digitalprimates.math {
+ import flash.geom.Point;
+
+ /**
+ * Class to represent a mathematical circle in addition to circle-specific convenience methods.
+ *
+ * @author mlabriola
+ *
+ */
+ public class Circle {
+ /**
+ * Constant representing the number of radians in a circle
+ */
+ public static const RADIANS_PER_CIRCLE:Number = Math.PI * 2;
+
+ private var _origin:Point = new Point( 0, 0 );
+ private var _radius:Number;
+
+ /**
+ * Returns the circle's origin point as a <code>flash.geom.Point</code> object.
+ * The <code>origin</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's origin point.
+ *
+ */
+ public function get origin():Point {
+ return _origin;
+ }
+
+ /**
+ * Returns the circle's radius as a <code>Number</code>.
+ * The <code>radius</code> is a read only property supplied during the instantiation
+ * of the Circle.
+ *
+ * @return The circle's radius.
+ */
+ public function get radius():Number {
+ return _radius;
+ }
+
+ /**
+ * Returns the circle's diameter based on the <code>radius</code> property.
+ * The <code>diameter</code> is a read only property.
+ *
+ * @see #radius
+ * @return The circle's diameter.
+ */
+ public function get diameter():Number {
+ return radius * 2;
+ }
+
+ /**
+ * Returns a point on the circle at a given radian offset.
+ *
+ * @param t radian position along the circle. 0 is the top-most point of the circle.
+ * @return a Point object describing the cartesian coordinate of the point.
+ *
+ */
+ public function getPointOnCircle( t:Number ):Point {
+ var x:Number = origin.x + ( radius * Math.cos( t ) );
+ var y:Number = origin.y + ( radius * Math.sin( t ) );
+
+ return new Point( x, y );
+ }
+
+ /**
+ *
+ * Convenience method for converting radians to degrees.
+ *
+ * @param radians a radian offset from the top-most point of the circle.
+ * @return a corresponding angle represented in degrees.
+ *
+ */
+ public function radiansToDegrees( radians:Number ):Number {
+ return ( ( radians - Math.PI/2 ) * 180 / Math.PI );
+ }
+
+ /**
+ * Comparison method to determine circle equivalence (same center and radius).
+ *
+ * @param circle a circle for comparison
+ * @return a boolean indicating if the circles are equivalent
+ *
+ */
+ public function equals( circle:Circle ):Boolean {
+ var equal:Boolean = false;
+
+ if ( ( circle ) && ( this.radius == circle.radius ) && ( this.origin ) && ( circle.origin ) ) {
+ if ( ( this.origin.x == circle.origin.x ) && ( this.origin.y == circle.origin.y ) ) {
+ equal = true;
+ }
+ }
+
+ return equal;
+ }
+
+ /**
+ * Creates a new circle
+ *
+ * @param origin the origin point of the new circle
+ * @param radius the radius of the new circle
+ *
+ */
+ public function Circle( origin:Point, radius:Number ) {
+
+ if ( ( radius <= 0 ) || isNaN( radius ) ) {
+ throw new RangeError("Radius must be a positive Number");
+ }
+
+ this._origin = origin;
+ this._radius = radius;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
new file mode 100644
index 0000000..f85bf23
--- /dev/null
+++ b/FlexUnit4Tutorials/Unit4/Start/FlexUnit4Training_wt3/tests/math/testcases/BasicCircleTest.as
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package math.testcases {
+ import flash.geom.Point;
+
+ import net.digitalprimates.math.Circle;
+
+ import org.flexunit.asserts.assertEquals;
+ import org.flexunit.asserts.assertFalse;
+ import org.flexunit.asserts.assertTrue;
+
+ public class BasicCircleTest {
+
+ [Test]
+ public function shouldReturnProvidedRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 5, circle.radius );
+ }
+
+ [Test]
+ public function shouldComputeCorrectDiameter ():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 10, circle.diameter );
+ }
+
+ [Test]
+ public function shouldReturnProvidedOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ assertEquals( 0, circle.origin.x );
+ assertEquals( 0, circle.origin.y );
+ }
+
+ [Test]
+ public function shouldReturnTrueForEqualCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+ assertTrue( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalOrigin():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldReturnFalseForUnequalRadius():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+ assertFalse( circle.equals( circle2 ) );
+ }
+
+ [Test]
+ public function shouldGetPointsOnCircle():void {
+ var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+ var point:Point;
+
+ //top-most point of circle
+ point = circle.getPointOnCircle( 0 );
+ assertEquals( 5, point.x );
+ assertEquals( 0, point.y );
+
+ //bottom-most point of circle
+ point = circle.getPointOnCircle( Math.PI );
+ assertEquals( -5, point.x );
+ assertEquals( 0, point.y );
+ }
+
+ [Test]
+ public function shouldThrowRangeError():void {
+
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastRun.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
deleted file mode 100644
index b85054b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.FlexUnitSettings/FlexUnitApplicationLastSelection.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<testrun name="" >
-<testsuite name="Default Test Suite" project="FlexUnit4_1_B1_BaseDemos">
-<testsuite name="flexUnitTests:BasicCircleTest" type="testcaseclass"/>
-</testsuite>
-</testrun>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
deleted file mode 100644
index d6472fe..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.flexProperties
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/FlexUnit4_1_B1_BaseDemos.fml" toolCompile="true" useServerFlexSDK="false" version="2"/>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
deleted file mode 100644
index bde0485..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.fxpProperties
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="592377da-210b-4153-8be6-57ad3a4108e4" projectUUID="592377da-210b-4153-8be6-57ad3a4108e4" sdkVersion="4.1.0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f" version="4">
- <projects/>
- <src>
- <linked isMain="false" location="tests" path="tests" position="0" uuid="7945279f-5fa2-4363-9335-1e25bfaa7f51"/>
- </src>
- <swc>
- <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="ebc498b9-1dab-48a5-84f7-21955494340f"/>
- <linked location="C:/github/mockolate.git/FlexUnit4_1_B1_BaseDemos/libs" path="/libs" position="1" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/Common/" position="2" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" path="${FLEXUNIT_LIB_LOCATION}/version4libs/FlexProject/" position="3" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- <linked location="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" path="${FLEXUNIT_LOCALE_LOCATION}/version4locale/" position="4" uuid="e49a9e0c-4692-4c13-92a8-aab82a596910"/>
- </swc>
- <misc/>
- <theme/>
-</fxpProperties>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
deleted file mode 100644
index 711e3b9..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<projectDescription>
- <name>FlexUnit4Training_wt1</name>
- <comment/>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.adobe.flexbuilder.project.flexnature</nature>
- <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
- </natures>
-</projectDescription>
-
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 91af8ec..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#Wed Jun 09 10:59:48 CDT 2010
-eclipse.preferences.version=1
-encoding/<project>=utf-8
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
deleted file mode 100644
index 8716330..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
-
-#ie_historyFrame { width: 0px; height: 0px; display:none }
-#firefox_anchorDiv { width: 0px; height: 0px; display:none }
-#safari_formDiv { width: 0px; height: 0px; display:none }
-#safari_rememberDiv { width: 0px; height: 0px; display:none }
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
deleted file mode 100644
index 61b46f2..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/history.js
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-BrowserHistoryUtils = {
- addEvent: function(elm, evType, fn, useCapture) {
- useCapture = useCapture || false;
- if (elm.addEventListener) {
- elm.addEventListener(evType, fn, useCapture);
- return true;
- }
- else if (elm.attachEvent) {
- var r = elm.attachEvent('on' + evType, fn);
- return r;
- }
- else {
- elm['on' + evType] = fn;
- }
- }
-}
-
-BrowserHistory = (function() {
- // type of browser
- var browser = {
- ie: false,
- ie8: false,
- firefox: false,
- safari: false,
- opera: false,
- version: -1
- };
-
- // if setDefaultURL has been called, our first clue
- // that the SWF is ready and listening
- //var swfReady = false;
-
- // the URL we'll send to the SWF once it is ready
- //var pendingURL = '';
-
- // Default app state URL to use when no fragment ID present
- var defaultHash = '';
-
- // Last-known app state URL
- var currentHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHref = document.location.href;
-
- // Initial URL (used only by IE)
- var initialHash = document.location.hash;
-
- // History frame source URL prefix (used only by IE)
- var historyFrameSourcePrefix = 'history/historyFrame.html?';
-
- // History maintenance (used only by Safari)
- var currentHistoryLength = -1;
-
- var historyHash = [];
-
- var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
-
- var backStack = [];
- var forwardStack = [];
-
- var currentObjectId = null;
-
- //UserAgent detection
- var useragent = navigator.userAgent.toLowerCase();
-
- if (useragent.indexOf("opera") != -1) {
- browser.opera = true;
- } else if (useragent.indexOf("msie") != -1) {
- browser.ie = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
- if (browser.version == 8)
- {
- browser.ie = false;
- browser.ie8 = true;
- }
- } else if (useragent.indexOf("safari") != -1) {
- browser.safari = true;
- browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
- } else if (useragent.indexOf("gecko") != -1) {
- browser.firefox = true;
- }
-
- if (browser.ie == true && browser.version == 7) {
- window["_ie_firstload"] = false;
- }
-
- function hashChangeHandler()
- {
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
-
- // Accessor functions for obtaining specific elements of the page.
- function getHistoryFrame()
- {
- return document.getElementById('ie_historyFrame');
- }
-
- function getAnchorElement()
- {
- return document.getElementById('firefox_anchorDiv');
- }
-
- function getFormElement()
- {
- return document.getElementById('safari_formDiv');
- }
-
- function getRememberElement()
- {
- return document.getElementById("safari_remember_field");
- }
-
- // Get the Flash player object for performing ExternalInterface callbacks.
- // Updated for changes to SWFObject2.
- function getPlayer(id) {
- var i;
-
- if (id && document.getElementById(id)) {
- var r = document.getElementById(id);
- if (typeof r.SetVariable != "undefined") {
- return r;
- }
- else {
- var o = r.getElementsByTagName("object");
- var e = r.getElementsByTagName("embed");
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- return o[i];
- }
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- return e[i];
- }
- }
- }
- else {
- var o = document.getElementsByTagName("object");
- var e = document.getElementsByTagName("embed");
- for (i = 0; i < e.length; i++) {
- if (typeof e[i].browserURLChange != "undefined")
- {
- return e[i];
- }
- }
- for (i = 0; i < o.length; i++) {
- if (typeof o[i].browserURLChange != "undefined")
- {
- return o[i];
- }
- }
- }
- return undefined;
- }
-
- function getPlayers() {
- var i;
- var players = [];
- if (players.length == 0) {
- var tmp = document.getElementsByTagName('object');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- if (players.length == 0 || players[0].object == null) {
- var tmp = document.getElementsByTagName('embed');
- for (i = 0; i < tmp.length; i++)
- {
- if (typeof tmp[i].browserURLChange != "undefined")
- players.push(tmp[i]);
- }
- }
- return players;
- }
-
- function getIframeHash() {
- var doc = getHistoryFrame().contentWindow.document;
- var hash = String(doc.location.search);
- if (hash.length == 1 && hash.charAt(0) == "?") {
- hash = "";
- }
- else if (hash.length >= 2 && hash.charAt(0) == "?") {
- hash = hash.substring(1);
- }
- return hash;
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function getHash() {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- var idx = document.location.href.indexOf('#');
- return (idx >= 0) ? document.location.href.substr(idx+1) : '';
- }
-
- /* Get the current location hash excluding the '#' symbol. */
- function setHash(hash) {
- // It would be nice if we could use document.location.hash here,
- // but it's faulty sometimes.
- if (hash == '') hash = '#'
- document.location.hash = hash;
- }
-
- function createState(baseUrl, newUrl, flexAppUrl) {
- return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
- }
-
- /* Add a history entry to the browser.
- * baseUrl: the portion of the location prior to the '#'
- * newUrl: the entire new URL, including '#' and following fragment
- * flexAppUrl: the portion of the location following the '#' only
- */
- function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
-
- //delete all the history entries
- forwardStack = [];
-
- if (browser.ie) {
- //Check to see if we are being asked to do a navigate for the first
- //history entry, and if so ignore, because it's coming from the creation
- //of the history iframe
- if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
- currentHref = initialHref;
- return;
- }
- if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
- newUrl = baseUrl + '#' + defaultHash;
- flexAppUrl = defaultHash;
- } else {
- // for IE, tell the history frame to go somewhere without a '#'
- // in order to get this entry into the browser history.
- getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
- }
- setHash(flexAppUrl);
- } else {
-
- //ADR
- if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
- initialState = createState(baseUrl, newUrl, flexAppUrl);
- } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
- backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
- }
-
- if (browser.safari) {
- // for Safari, submit a form whose action points to the desired URL
- if (browser.version <= 419.3) {
- var file = window.location.pathname.toString();
- file = file.substring(file.lastIndexOf("/")+1);
- getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
- //get the current elements and add them to the form
- var qs = window.location.search.substring(1);
- var qs_arr = qs.split("&");
- for (var i = 0; i < qs_arr.length; i++) {
- var tmp = qs_arr[i].split("=");
- var elem = document.createElement("input");
- elem.type = "hidden";
- elem.name = tmp[0];
- elem.value = tmp[1];
- document.forms.historyForm.appendChild(elem);
- }
- document.forms.historyForm.submit();
- } else {
- top.location.hash = flexAppUrl;
- }
- // We also have to maintain the history by hand for Safari
- historyHash[history.length] = flexAppUrl;
- _storeStates();
- } else {
- // Otherwise, write an anchor into the page and tell the browser to go there
- addAnchor(flexAppUrl);
- setHash(flexAppUrl);
-
- // For IE8 we must restore full focus/activation to our invoking player instance.
- if (browser.ie8)
- getPlayer().focus();
- }
- }
- backStack.push(createState(baseUrl, newUrl, flexAppUrl));
- }
-
- function _storeStates() {
- if (browser.safari) {
- getRememberElement().value = historyHash.join(",");
- }
- }
-
- function handleBackButton() {
- //The "current" page is always at the top of the history stack.
- var current = backStack.pop();
- if (!current) { return; }
- var last = backStack[backStack.length - 1];
- if (!last && backStack.length == 0){
- last = initialState;
- }
- forwardStack.push(current);
- }
-
- function handleForwardButton() {
- //summary: private method. Do not call this directly.
-
- var last = forwardStack.pop();
- if (!last) { return; }
- backStack.push(last);
- }
-
- function handleArbitraryUrl() {
- //delete all the history entries
- forwardStack = [];
- }
-
- /* Called periodically to poll to see if we need to detect navigation that has occurred */
- function checkForUrlChange() {
-
- if (browser.ie) {
- if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
- //This occurs when the user has navigated to a specific URL
- //within the app, and didn't use browser back/forward
- //IE seems to have a bug where it stops updating the URL it
- //shows the end-user at this point, but programatically it
- //appears to be correct. Do a full app reload to get around
- //this issue.
- if (browser.version < 7) {
- currentHref = document.location.href;
- document.location.reload();
- } else {
- if (getHash() != getIframeHash()) {
- // this.iframe.src = this.blankURL + hash;
- var sourceToSet = historyFrameSourcePrefix + getHash();
- getHistoryFrame().src = sourceToSet;
- currentHref = document.location.href;
- }
- }
- }
- }
-
- if (browser.safari) {
- // For Safari, we have to check to see if history.length changed.
- if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
- //alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
- var flexAppUrl = getHash();
- if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
- {
- // If it did change and we're running Safari 3.x or earlier,
- // then we have to look the old state up in our hand-maintained
- // array since document.location.hash won't have changed,
- // then call back into BrowserManager.
- currentHistoryLength = history.length;
- flexAppUrl = historyHash[currentHistoryLength];
- }
-
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- _storeStates();
- }
- }
- if (browser.firefox) {
- if (currentHref != document.location.href) {
- var bsl = backStack.length;
-
- var urlActions = {
- back: false,
- forward: false,
- set: false
- }
-
- if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
- urlActions.back = true;
- // FIXME: could this ever be a forward button?
- // we can't clear it because we still need to check for forwards. Ugg.
- // clearInterval(this.locationTimer);
- handleBackButton();
- }
-
- // first check to see if we could have gone forward. We always halt on
- // a no-hash item.
- if (forwardStack.length > 0) {
- if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
- urlActions.forward = true;
- handleForwardButton();
- }
- }
-
- // ok, that didn't work, try someplace back in the history stack
- if ((bsl >= 2) && (backStack[bsl - 2])) {
- if (backStack[bsl - 2].flexAppUrl == getHash()) {
- urlActions.back = true;
- handleBackButton();
- }
- }
-
- if (!urlActions.back && !urlActions.forward) {
- var foundInStacks = {
- back: -1,
- forward: -1
- }
-
- for (var i = 0; i < backStack.length; i++) {
- if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.back = i;
- }
- }
- for (var i = 0; i < forwardStack.length; i++) {
- if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
- arbitraryUrl = true;
- foundInStacks.forward = i;
- }
- }
- handleArbitraryUrl();
- }
-
- // Firefox changed; do a callback into BrowserManager to tell it.
- currentHref = document.location.href;
- var flexAppUrl = getHash();
- //ADR: to fix multiple
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- pl[i].browserURLChange(flexAppUrl);
- }
- } else {
- getPlayer().browserURLChange(flexAppUrl);
- }
- }
- }
- //setTimeout(checkForUrlChange, 50);
- }
-
- /* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
- function addAnchor(flexAppUrl)
- {
- if (document.getElementsByName(flexAppUrl).length == 0) {
- getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
- }
- }
-
- var _initialize = function () {
- if (browser.ie)
- {
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
- }
- }
- historyFrameSourcePrefix = iframe_location + "?";
- var src = historyFrameSourcePrefix;
-
- var iframe = document.createElement("iframe");
- iframe.id = 'ie_historyFrame';
- iframe.name = 'ie_historyFrame';
- iframe.src = 'javascript:false;';
-
- try {
- document.body.appendChild(iframe);
- } catch(e) {
- setTimeout(function() {
- document.body.appendChild(iframe);
- }, 0);
- }
- }
-
- if (browser.safari)
- {
- var rememberDiv = document.createElement("div");
- rememberDiv.id = 'safari_rememberDiv';
- document.body.appendChild(rememberDiv);
- rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
-
- var formDiv = document.createElement("div");
- formDiv.id = 'safari_formDiv';
- document.body.appendChild(formDiv);
-
- var reloader_content = document.createElement('div');
- reloader_content.id = 'safarireloader';
- var scripts = document.getElementsByTagName('script');
- for (var i = 0, s; s = scripts[i]; i++) {
- if (s.src.indexOf("history.js") > -1) {
- html = (new String(s.src)).replace(".js", ".html");
- }
- }
- reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
- document.body.appendChild(reloader_content);
- reloader_content.style.position = 'absolute';
- reloader_content.style.left = reloader_content.style.top = '-9999px';
- iframe = reloader_content.getElementsByTagName('iframe')[0];
-
- if (document.getElementById("safari_remember_field").value != "" ) {
- historyHash = document.getElementById("safari_remember_field").value.split(",");
- }
-
- }
-
- if (browser.firefox || browser.ie8)
- {
- var anchorDiv = document.createElement("div");
- anchorDiv.id = 'firefox_anchorDiv';
- document.body.appendChild(anchorDiv);
- }
-
- if (browser.ie8)
- document.body.onhashchange = hashChangeHandler;
- //setTimeout(checkForUrlChange, 50);
- }
-
- return {
- historyHash: historyHash,
- backStack: function() { return backStack; },
- forwardStack: function() { return forwardStack },
- getPlayer: getPlayer,
- initialize: function(src) {
- _initialize(src);
- },
- setURL: function(url) {
- document.location.href = url;
- },
- getURL: function() {
- return document.location.href;
- },
- getTitle: function() {
- return document.title;
- },
- setTitle: function(title) {
- try {
- backStack[backStack.length - 1].title = title;
- } catch(e) { }
- //if on safari, set the title to be the empty string.
- if (browser.safari) {
- if (title == "") {
- try {
- var tmp = window.location.href.toString();
- title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
- } catch(e) {
- title = "";
- }
- }
- }
- document.title = title;
- },
- setDefaultURL: function(def)
- {
- defaultHash = def;
- def = getHash();
- //trailing ? is important else an extra frame gets added to the history
- //when navigating back to the first page. Alternatively could check
- //in history frame navigation to compare # and ?.
- if (browser.ie)
- {
- window['_ie_firstload'] = true;
- var sourceToSet = historyFrameSourcePrefix + def;
- var func = function() {
- getHistoryFrame().src = sourceToSet;
- window.location.replace("#" + def);
- setInterval(checkForUrlChange, 50);
- }
- try {
- func();
- } catch(e) {
- window.setTimeout(function() { func(); }, 0);
- }
- }
-
- if (browser.safari)
- {
- currentHistoryLength = history.length;
- if (historyHash.length == 0) {
- historyHash[currentHistoryLength] = def;
- var newloc = "#" + def;
- window.location.replace(newloc);
- } else {
- //alert(historyHash[historyHash.length-1]);
- }
- //setHash(def);
- setInterval(checkForUrlChange, 50);
- }
-
-
- if (browser.firefox || browser.opera)
- {
- var reg = new RegExp("#" + def + "$");
- if (window.location.toString().match(reg)) {
- } else {
- var newloc ="#" + def;
- window.location.replace(newloc);
- }
- setInterval(checkForUrlChange, 50);
- //setHash(def);
- }
-
- },
-
- /* Set the current browser URL; called from inside BrowserManager to propagate
- * the application state out to the container.
- */
- setBrowserURL: function(flexAppUrl, objectId) {
- if (browser.ie && typeof objectId != "undefined") {
- currentObjectId = objectId;
- }
- //fromIframe = fromIframe || false;
- //fromFlex = fromFlex || false;
- //alert("setBrowserURL: " + flexAppUrl);
- //flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
-
- var pos = document.location.href.indexOf('#');
- var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
- var newUrl = baseUrl + '#' + flexAppUrl;
-
- if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
- currentHref = newUrl;
- addHistoryEntry(baseUrl, newUrl, flexAppUrl);
- currentHistoryLength = history.length;
- }
- },
-
- browserURLChange: function(flexAppUrl) {
- var objectId = null;
- if (browser.ie && currentObjectId != null) {
- objectId = currentObjectId;
- }
- pendingURL = '';
-
- if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
- var pl = getPlayers();
- for (var i = 0; i < pl.length; i++) {
- try {
- pl[i].browserURLChange(flexAppUrl);
- } catch(e) { }
- }
- } else {
- try {
- getPlayer(objectId).browserURLChange(flexAppUrl);
- } catch(e) { }
- }
-
- currentObjectId = null;
- },
- getUserAgent: function() {
- return navigator.userAgent;
- },
- getPlatform: function() {
- return navigator.platform;
- }
-
- }
-
-})();
-
-// Initialization
-
-// Automated unit testing and other diagnostics
-
-function setURL(url)
-{
- document.location.href = url;
-}
-
-function backButton()
-{
- history.back();
-}
-
-function forwardButton()
-{
- history.forward();
-}
-
-function goForwardOrBackInHistory(step)
-{
- history.go(step);
-}
-
-//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
-(function(i) {
- var u =navigator.userAgent;var e=/*@cc_on!@*/false;
- var st = setTimeout;
- if(/webkit/i.test(u)){
- st(function(){
- var dr=document.readyState;
- if(dr=="loaded"||dr=="complete"){i()}
- else{st(arguments.callee,10);}},10);
- } else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
- document.addEventListener("DOMContentLoaded",i,false);
- } else if(e){
- (function(){
- var t=document.createElement('doc:rdy');
- try{t.doScroll('left');
- i();t=null;
- }catch(e){st(arguments.callee,0);}})();
- } else{
- window.onload=i;
- }
-})( function() {BrowserHistory.initialize();} );
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
deleted file mode 100644
index c8af338..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/history/historyFrame.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
- <META HTTP-EQUIV="Expires" CONTENT="-1">
- </head>
- <body>
- <script>
- function processUrl()
- {
-
- var pos = url.indexOf("?");
- url = pos != -1 ? url.substr(pos + 1) : "";
- if (!parent._ie_firstload) {
- parent.BrowserHistory.setBrowserURL(url);
- try {
- parent.BrowserHistory.browserURLChange(url);
- } catch(e) { }
- } else {
- parent._ie_firstload = false;
- }
- }
-
- var url = document.location.href;
- processUrl();
- document.write(encodeURIComponent(url));
- </script>
- Hidden frame for Browser History support.
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
deleted file mode 100644
index 2146ca8..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/index.template.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- saved from url=(0014)about:internet -->
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <!--
- Smart developers always View Source.
-
- This application was built using Adobe Flex, an open source framework
- for building rich Internet applications that get delivered via the
- Flash Player or to desktops via Adobe AIR.
-
- Learn more about Flex at http://flex.org
- // -->
- <head>
- <title>${title}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
- the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
- the percentage of the height of its parent container, which has to be set explicitly. Initially,
- don't display flashContent div so it won't show if JavaScript disabled.
- -->
- <style type="text/css" media="screen">
- html, body { height:100%; }
- body { margin:0; padding:0; overflow:auto; text-align:center;
- background-color: ${bgcolor}; }
- #flashContent { display:none; }
- </style>
-
- <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
- <!-- BEGIN Browser History required section ${useBrowserHistory}>
- <link rel="stylesheet" type="text/css" href="history/history.css" />
- <script type="text/javascript" src="history/history.js"></script>
- <!${useBrowserHistory} END Browser History required section -->
-
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript">
- <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
- var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
- <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
- var xiSwfUrlStr = "${expressInstallSwf}";
- var flashvars = {};
- var params = {};
- params.quality = "high";
- params.bgcolor = "${bgcolor}";
- params.allowscriptaccess = "sameDomain";
- params.allowfullscreen = "true";
- var attributes = {};
- attributes.id = "${application}";
- attributes.name = "${application}";
- attributes.align = "middle";
- swfobject.embedSWF(
- "${swf}.swf", "flashContent",
- "${width}", "${height}",
- swfVersionStr, xiSwfUrlStr,
- flashvars, params, attributes);
- <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
- swfobject.createCSS("#flashContent", "display:block;text-align:left;");
- </script>
- </head>
- <body>
- <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
- JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
- when JavaScript is disabled.
- -->
- <div id="flashContent">
- <p>
- To view this page ensure that Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is installed.
- </p>
- <script type="text/javascript">
- var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
- document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
- + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
- </script>
- </div>
-
- <noscript>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
- <param name="movie" value="${swf}.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
- <param name="quality" value="high" />
- <param name="bgcolor" value="${bgcolor}" />
- <param name="allowScriptAccess" value="sameDomain" />
- <param name="allowFullScreen" value="true" />
- <!--<![endif]-->
- <!--[if gte IE 6]>-->
- <p>
- Either scripts and active content are not permitted to run or Adobe Flash Player version
- ${version_major}.${version_minor}.${version_revision} or greater is not installed.
- </p>
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </noscript>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf
deleted file mode 100644
index bdc3437..0000000
Binary files a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/playerProductInstall.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
deleted file mode 100644
index c862aae..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/html-template/swfobject.js
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-
-var swfobject = function() {
-
- var UNDEF = "undefined",
- OBJECT = "object",
- SHOCKWAVE_FLASH = "Shockwave Flash",
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
- FLASH_MIME_TYPE = "application/x-shockwave-flash",
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",
- ON_READY_STATE_CHANGE = "onreadystatechange",
-
- win = window,
- doc = document,
- nav = navigator,
-
- plugin = false,
- domLoadFnArr = [main],
- regObjArr = [],
- objIdArr = [],
- listenersArr = [],
- storedAltContent,
- storedAltContentId,
- storedCallbackFn,
- storedCallbackObj,
- isDomLoaded = false,
- isExpressInstallActive = false,
- dynamicStylesheet,
- dynamicStylesheetMedia,
- autoHideShow = true,
-
- /* Centralized function for browser feature detection
- - User agent string detection is only used when no good alternative is possible
- - Is executed directly for optimal performance
- */
- ua = function() {
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
- u = nav.userAgent.toLowerCase(),
- p = nav.platform.toLowerCase(),
- windows = p ? /win/.test(p) : /win/.test(u),
- mac = p ? /mac/.test(p) : /mac/.test(u),
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
- playerVersion = [0,0,0],
- d = null;
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
- d = nav.plugins[SHOCKWAVE_FLASH].description;
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
- plugin = true;
- ie = false; // cascaded feature detection for Internet Explorer
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- }
- else if (typeof win.ActiveXObject != UNDEF) {
- try {
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
- if (a) { // a will return null when ActiveX is disabled
- d = a.GetVariable("$version");
- if (d) {
- ie = true; // cascaded feature detection for Internet Explorer
- d = d.split(" ")[1].split(",");
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- }
- catch(e) {}
- }
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
- }(),
-
- /* Cross-browser onDomLoad
- - Will fire an event as soon as the DOM of a web page is loaded
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- - Regular onload serves as fallback
- */
- onDomLoad = function() {
- if (!ua.w3) { return; }
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
- callDomLoadFunctions();
- }
- if (!isDomLoaded) {
- if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
- }
- if (ua.ie && ua.win) {
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {
- if (doc.readyState == "complete") {
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
- callDomLoadFunctions();
- }
- });
- if (win == top) { // if not inside an iframe
- (function(){
- if (isDomLoaded) { return; }
- try {
- doc.documentElement.doScroll("left");
- }
- catch(e) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- }
- if (ua.wk) {
- (function(){
- if (isDomLoaded) { return; }
- if (!/loaded|complete/.test(doc.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- callDomLoadFunctions();
- })();
- }
- addLoadEvent(callDomLoadFunctions);
- }
- }();
-
- function callDomLoadFunctions() {
- if (isDomLoaded) { return; }
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
- t.parentNode.removeChild(t);
- }
- catch (e) { return; }
- isDomLoaded = true;
- var dl = domLoadFnArr.length;
- for (var i = 0; i < dl; i++) {
- domLoadFnArr[i]();
- }
- }
-
- function addDomLoadEvent(fn) {
- if (isDomLoaded) {
- fn();
- }
- else {
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
- }
- }
-
- /* Cross-browser onload
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- - Will fire an event as soon as a web page including all of its assets are loaded
- */
- function addLoadEvent(fn) {
- if (typeof win.addEventListener != UNDEF) {
- win.addEventListener("load", fn, false);
- }
- else if (typeof doc.addEventListener != UNDEF) {
- doc.addEventListener("load", fn, false);
- }
- else if (typeof win.attachEvent != UNDEF) {
- addListener(win, "onload", fn);
- }
- else if (typeof win.onload == "function") {
- var fnOld = win.onload;
- win.onload = function() {
- fnOld();
- fn();
- };
- }
- else {
- win.onload = fn;
- }
- }
-
- /* Main function
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)
- */
- function main() {
- if (plugin) {
- testPlayerVersion();
- }
- else {
- matchVersions();
- }
- }
-
- /* Detect the Flash Player version for non-Internet Explorer browsers
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
- a. Both release and build numbers can be detected
- b. Avoid wrong descriptions by corrupt installers provided by Adobe
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
- */
- function testPlayerVersion() {
- var b = doc.getElementsByTagName("body")[0];
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- var t = b.appendChild(o);
- if (t) {
- var counter = 0;
- (function(){
- if (typeof t.GetVariable != UNDEF) {
- var d = t.GetVariable("$version");
- if (d) {
- d = d.split(" ")[1].split(",");
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
- }
- }
- else if (counter < 10) {
- counter++;
- setTimeout(arguments.callee, 10);
- return;
- }
- b.removeChild(o);
- t = null;
- matchVersions();
- })();
- }
- else {
- matchVersions();
- }
- }
-
- /* Perform Flash Player and SWF version matching; static publishing only
- */
- function matchVersions() {
- var rl = regObjArr.length;
- if (rl > 0) {
- for (var i = 0; i < rl; i++) { // for each registered object element
- var id = regObjArr[i].id;
- var cb = regObjArr[i].callbackFn;
- var cbObj = {success:false, id:id};
- if (ua.pv[0] > 0) {
- var obj = getElementById(id);
- if (obj) {
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
- setVisibility(id, true);
- if (cb) {
- cbObj.success = true;
- cbObj.ref = getObjectById(id);
- cb(cbObj);
- }
- }
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
- var att = {};
- att.data = regObjArr[i].expressInstall;
- att.width = obj.getAttribute("width") || "0";
- att.height = obj.getAttribute("height") || "0";
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
- // parse HTML object param element's name-value pairs
- var par = {};
- var p = obj.getElementsByTagName("param");
- var pl = p.length;
- for (var j = 0; j < pl; j++) {
- if (p[j].getAttribute("name").toLowerCase() != "movie") {
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");
- }
- }
- showExpressInstall(att, par, id, cb);
- }
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
- displayAltContent(obj);
- if (cb) { cb(cbObj); }
- }
- }
- }
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
- setVisibility(id, true);
- if (cb) {
- var o = getObjectById(id); // test whether there is an HTML object element or not
- if (o && typeof o.SetVariable != UNDEF) {
- cbObj.success = true;
- cbObj.ref = o;
- }
- cb(cbObj);
- }
- }
- }
- }
- }
-
- function getObjectById(objectIdStr) {
- var r = null;
- var o = getElementById(objectIdStr);
- if (o && o.nodeName == "OBJECT") {
- if (typeof o.SetVariable != UNDEF) {
- r = o;
- }
- else {
- var n = o.getElementsByTagName(OBJECT)[0];
- if (n) {
- r = n;
- }
- }
- }
- return r;
- }
-
- /* Requirements for Adobe Express Install
- - only one instance can be active at a time
- - fp 6.0.65 or higher
- - Win/Mac OS only
- - no Webkit engines older than version 312
- */
- function canExpressInstall() {
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
- }
-
- /* Show the Adobe Express Install dialog
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
- */
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
- isExpressInstallActive = true;
- storedCallbackFn = callbackFn || null;
- storedCallbackObj = {success:false, id:replaceElemIdStr};
- var obj = getElementById(replaceElemIdStr);
- if (obj) {
- if (obj.nodeName == "OBJECT") { // static publishing
- storedAltContent = abstractAltContent(obj);
- storedAltContentId = null;
- }
- else { // dynamic publishing
- storedAltContent = obj;
- storedAltContentId = replaceElemIdStr;
- }
- att.id = EXPRESS_INSTALL_ID;
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
- fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + fv;
- }
- else {
- par.flashvars = fv;
- }
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- if (ua.ie && ua.win && obj.readyState != 4) {
- var newObj = createElement("div");
- replaceElemIdStr += "SWFObjectNew";
- newObj.setAttribute("id", replaceElemIdStr);
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- createSWF(att, par, replaceElemIdStr);
- }
- }
-
- /* Functions to abstract and display alternative content
- */
- function displayAltContent(obj) {
- if (ua.ie && ua.win && obj.readyState != 4) {
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
- var el = createElement("div");
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
- el.parentNode.replaceChild(abstractAltContent(obj), el);
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- obj.parentNode.removeChild(obj);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);
- }
- }
-
- function abstractAltContent(obj) {
- var ac = createElement("div");
- if (ua.win && ua.ie) {
- ac.innerHTML = obj.innerHTML;
- }
- else {
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];
- if (nestedObj) {
- var c = nestedObj.childNodes;
- if (c) {
- var cl = c.length;
- for (var i = 0; i < cl; i++) {
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
- ac.appendChild(c[i].cloneNode(true));
- }
- }
- }
- }
- }
- return ac;
- }
-
- /* Cross-browser dynamic SWF creation
- */
- function createSWF(attObj, parObj, id) {
- var r, el = getElementById(id);
- if (ua.wk && ua.wk < 312) { return r; }
- if (el) {
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
- attObj.id = id;
- }
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
- var att = "";
- for (var i in attObj) {
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
- if (i.toLowerCase() == "data") {
- parObj.movie = attObj[i];
- }
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- att += ' class="' + attObj[i] + '"';
- }
- else if (i.toLowerCase() != "classid") {
- att += ' ' + i + '="' + attObj[i] + '"';
- }
- }
- }
- var par = "";
- for (var j in parObj) {
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';
- }
- }
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
- r = getElementById(attObj.id);
- }
- else { // well-behaving browsers
- var o = createElement(OBJECT);
- o.setAttribute("type", FLASH_MIME_TYPE);
- for (var m in attObj) {
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
- o.setAttribute("class", attObj[m]);
- }
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
- o.setAttribute(m, attObj[m]);
- }
- }
- }
- for (var n in parObj) {
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
- createObjParam(o, n, parObj[n]);
- }
- }
- el.parentNode.replaceChild(o, el);
- r = o;
- }
- }
- return r;
- }
-
- function createObjParam(el, pName, pValue) {
- var p = createElement("param");
- p.setAttribute("name", pName);
- p.setAttribute("value", pValue);
- el.appendChild(p);
- }
-
- /* Cross-browser SWF removal
- - Especially needed to safely and completely remove a SWF in Internet Explorer
- */
- function removeSWF(id) {
- var obj = getElementById(id);
- if (obj && obj.nodeName == "OBJECT") {
- if (ua.ie && ua.win) {
- obj.style.display = "none";
- (function(){
- if (obj.readyState == 4) {
- removeObjectInIE(id);
- }
- else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- else {
- obj.parentNode.removeChild(obj);
- }
- }
- }
-
- function removeObjectInIE(id) {
- var obj = getElementById(id);
- if (obj) {
- for (var i in obj) {
- if (typeof obj[i] == "function") {
- obj[i] = null;
- }
- }
- obj.parentNode.removeChild(obj);
- }
- }
-
- /* Functions to optimize JavaScript compression
- */
- function getElementById(id) {
- var el = null;
- try {
- el = doc.getElementById(id);
- }
- catch (e) {}
- return el;
- }
-
- function createElement(el) {
- return doc.createElement(el);
- }
-
- /* Updated attachEvent function for Internet Explorer
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
- */
- function addListener(target, eventType, fn) {
- target.attachEvent(eventType, fn);
- listenersArr[listenersArr.length] = [target, eventType, fn];
- }
-
- /* Flash Player and SWF content version matching
- */
- function hasPlayerVersion(rv) {
- var pv = ua.pv, v = rv.split(".");
- v[0] = parseInt(v[0], 10);
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
- v[2] = parseInt(v[2], 10) || 0;
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
- }
-
- /* Cross-browser dynamic CSS creation
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
- */
- function createCSS(sel, decl, media, newStyle) {
- if (ua.ie && ua.mac) { return; }
- var h = doc.getElementsByTagName("head")[0];
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element
- var m = (media && typeof media == "string") ? media : "screen";
- if (newStyle) {
- dynamicStylesheet = null;
- dynamicStylesheetMedia = null;
- }
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
- // create dynamic stylesheet + get a global reference to it
- var s = createElement("style");
- s.setAttribute("type", "text/css");
- s.setAttribute("media", m);
- dynamicStylesheet = h.appendChild(s);
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
- }
- dynamicStylesheetMedia = m;
- }
- // add style rule
- if (ua.ie && ua.win) {
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
- dynamicStylesheet.addRule(sel, decl);
- }
- }
- else {
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
- }
- }
- }
-
- function setVisibility(id, isVisible) {
- if (!autoHideShow) { return; }
- var v = isVisible ? "visible" : "hidden";
- if (isDomLoaded && getElementById(id)) {
- getElementById(id).style.visibility = v;
- }
- else {
- createCSS("#" + id, "visibility:" + v);
- }
- }
-
- /* Filter to avoid XSS attacks
- */
- function urlEncodeIfNecessary(s) {
- var regex = /[\\\"<>\.;]/;
- var hasBadChars = regex.exec(s) != null;
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
- }
-
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
- */
- var cleanup = function() {
- if (ua.ie && ua.win) {
- window.attachEvent("onunload", function() {
- // remove listeners to avoid memory leaks
- var ll = listenersArr.length;
- for (var i = 0; i < ll; i++) {
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
- }
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
- var il = objIdArr.length;
- for (var j = 0; j < il; j++) {
- removeSWF(objIdArr[j]);
- }
- // cleanup library's main closures to avoid memory leaks
- for (var k in ua) {
- ua[k] = null;
- }
- ua = null;
- for (var l in swfobject) {
- swfobject[l] = null;
- }
- swfobject = null;
- });
- }
- }();
-
- return {
- /* Public API
- - Reference: http://code.google.com/p/swfobject/wiki/documentation
- */
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
- if (ua.w3 && objectIdStr && swfVersionStr) {
- var regObj = {};
- regObj.id = objectIdStr;
- regObj.swfVersion = swfVersionStr;
- regObj.expressInstall = xiSwfUrlStr;
- regObj.callbackFn = callbackFn;
- regObjArr[regObjArr.length] = regObj;
- setVisibility(objectIdStr, false);
- }
- else if (callbackFn) {
- callbackFn({success:false, id:objectIdStr});
- }
- },
-
- getObjectById: function(objectIdStr) {
- if (ua.w3) {
- return getObjectById(objectIdStr);
- }
- },
-
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
- var callbackObj = {success:false, id:replaceElemIdStr};
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
- setVisibility(replaceElemIdStr, false);
- addDomLoadEvent(function() {
- widthStr += ""; // auto-convert to string
- heightStr += "";
- var att = {};
- if (attObj && typeof attObj === OBJECT) {
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
- att[i] = attObj[i];
- }
- }
- att.data = swfUrlStr;
- att.width = widthStr;
- att.height = heightStr;
- var par = {};
- if (parObj && typeof parObj === OBJECT) {
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
- par[j] = parObj[j];
- }
- }
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
- if (typeof par.flashvars != UNDEF) {
- par.flashvars += "&" + k + "=" + flashvarsObj[k];
- }
- else {
- par.flashvars = k + "=" + flashvarsObj[k];
- }
- }
- }
- if (hasPlayerVersion(swfVersionStr)) { // create SWF
- var obj = createSWF(att, par, replaceElemIdStr);
- if (att.id == replaceElemIdStr) {
- setVisibility(replaceElemIdStr, true);
- }
- callbackObj.success = true;
- callbackObj.ref = obj;
- }
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
- att.data = xiSwfUrlStr;
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- return;
- }
- else { // show alternative content
- setVisibility(replaceElemIdStr, true);
- }
- if (callbackFn) { callbackFn(callbackObj); }
- });
- }
- else if (callbackFn) { callbackFn(callbackObj); }
- },
-
- switchOffAutoHideShow: function() {
- autoHideShow = false;
- },
-
- ua: ua,
-
- getFlashPlayerVersion: function() {
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
- },
-
- hasFlashPlayerVersion: hasPlayerVersion,
-
- createSWF: function(attObj, parObj, replaceElemIdStr) {
- if (ua.w3) {
- return createSWF(attObj, parObj, replaceElemIdStr);
- }
- else {
- return undefined;
- }
- },
-
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
- if (ua.w3 && canExpressInstall()) {
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);
- }
- },
-
- removeSWF: function(objElemIdStr) {
- if (ua.w3) {
- removeSWF(objElemIdStr);
- }
- },
-
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
- if (ua.w3) {
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);
- }
- },
-
- addDomLoadEvent: addDomLoadEvent,
-
- addLoadEvent: addLoadEvent,
-
- getQueryParamValue: function(param) {
- var q = doc.location.search || doc.location.hash;
- if (q) {
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
- if (param == null) {
- return urlEncodeIfNecessary(q);
- }
- var pairs = q.split("&");
- for (var i = 0; i < pairs.length; i++) {
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
-
- // For internal usage only
- expressInstallCallback: function() {
- if (isExpressInstallActive) {
- var obj = getElementById(EXPRESS_INSTALL_ID);
- if (obj && storedAltContent) {
- obj.parentNode.replaceChild(storedAltContent, obj);
- if (storedAltContentId) {
- setVisibility(storedAltContentId, true);
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
- }
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
- }
- isExpressInstallActive = false;
- }
- }
- };
-}();
http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/68f0bd35/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
----------------------------------------------------------------------
diff --git a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml b/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
deleted file mode 100644
index 689430b..0000000
--- a/FlexUnit4Tutorials/Unit4/completex/FlexUnit4Training_wt1/src/FlexUnit4Training.mxml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:flexui="flexunit.flexui.*" creationComplete="onCreationComplete()">
- <fx:Script>
- <![CDATA[
- import math.testcases.BasicCircleTest;
-
- public function currentRunTestSuite():Array
- {
- var testsToRun:Array = new Array();
- testsToRun.push( BasicCircleTest );
- return testsToRun;
- }
-
-
- private function onCreationComplete():void
- {
- testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "FlexUnit4Training");
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <flexui:FlexUnitTestRunnerUI id="testRunner"/>
-</s:Application>
\ No newline at end of file