Jan 27, 2009

Mac Firefox 3.0 + Flash + Javascript = Random Artifacts

If you have been using ExternalInterface calls to Javascript, you might be noticing some random artifacts popping up on your document using a Firefox 3.0 on a Mac. This is most noticeable when using SWFAddress to handle your deep linking. The problem is not actually SWFAddress itself. The problem lies in altering the DOM Window through ExternalInterface calls.



For some cases, you can replace:

ExternalInterface.call(" * your method * ", value);



With:

var urlReq:URLRequest = new URLRequest("javascript:*your method*('" + value + "');");
navigateToURL( urlReq , "_self" );




Using navigateToURL will actually fix most problems with ExternalInterface calls. However, if you do not want to go through your AS files changing your code, you can fix it from the JS end as well. Find out which Javascript call is causing the black marks and wrap it in any sort of 'setTimeout' function.

For example: YourJavascriptFile.js
Problem: window.scroll(0, value); // causes black marks
Solution: setTimeout( function(){ window.scroll(0, value) }, 1); // totally clean

The two ways I have replicated this error, so far, happen when you use any type of window scrolling or by altering the window's location/hash/href.

Below is a beautified version of the SWFAddress 2.2 javascript file with the fix clearly marked in red about half way down in the code. In a code editor, it is found on line 605. If you prefer the compact version, you can easily just run a search for the commented line and make the adjustments shown below.



/**
* SWFAddress 2.2: Deep linking for Flash and Ajax <http://www.asual.com/swfaddress/>
*
* SWFAddress is (c) 2006-2008 Rostislav Hristov and contributors
* This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*
*/
if (typeof asual == "undefined") {
asual = {};
}
if (typeof asual.swfaddress == "undefined") {
asual.swfaddress = {};
}
if (typeof asual.util == "undefined") {
asual.util = {};
}
asual.util.Browser = new
function() {
var B = -1,
D = navigator.userAgent,
H = false,
G = false,
F = false,
A = false,
C = false,
I = false;
var E = function(K, J) {
return parseFloat(D.substr(D.indexOf(K) + J));
};
if (A = /Opera/.test(D)) {
B = parseFloat(navigator.appVersion);
}
if (H = /MSIE/.test(D)) {
B = E("MSIE", 4);
}
if (I = /Chrome/.test(D)) {
B = E("Chrome", 7);
}
if (G = /Camino/.test(D)) {
B = E("Camino", 7);
}
if (F = (/AppleWebKit/.test(D) && !I)) {
B = E("Safari", 7);
}
if (C = (/Firefox/.test(D) && !G)) {
B = E("Firefox", 8);
}
this.toString = function() {
return "[class Browser]";
};
this.getVersion = function() {
return B;
};
this.isIE = function() {
return H;
};
this.isSafari = function() {
return F;
};
this.isOpera = function() {
return A;
};
this.isCamino = function() {
return G;
};
this.isFirefox = function() {
return C;
};
this.isChrome = function() {
return I;
};
};
asual.util.Events = new
function() {
var C = "DOMContentLoaded",
G = "onstop",
I = window,
F = document,
B = [],
A = asual.util,
D = A.Browser;
this.toString = function() {
return "[class Events]";
};
this.addListener = function(L, J, K) {
B.push({
o: L,
t: J,
l: K
});
if (! (J == C && (D.isIE() || D.isSafari()))) {
if (L.addEventListener) {
L.addEventListener(J, K, false);
} else {
if (L.attachEvent) {
L.attachEvent("on" + J, K);
}
}
}
};
this.removeListener = function(N, K, L) {
for (var J = 0,
M; M = B[J]; J++) {
if (M.o == N && M.t == K && M.l == L) {
B.splice(J, 1);
break;
}
}
if (! (K == C && (D.isIE() || D.isSafari()))) {
if (N.removeEventListener) {
N.removeEventListener(K, L, false);
} else {
if (N.detachEvent) {
N.detachEvent("on" + K, L);
}
}
}
};
var H = function() {
for (var K = 0,
J; J = B[K]; K++) {
if (J.t != C) {
A.Events.removeListener(J.o, J.t, J.l);
}
}
};
var E = function() {
if (F.readyState == "interactive") {
function J() {
F.detachEvent(G, J);
H();
};
F.attachEvent(G, J);
I.setTimeout(function() {
F.detachEvent(G, J);
},
0);
}
};
if (D.isIE() || D.isSafari()) { (function() {
try {
if ((D.isIE() && F.body) || !/loaded|complete/.test(F.readyState)) {
F.documentElement.doScroll("left");
}
} catch(K) {
return setTimeout(arguments.callee, 0);
}
for (var J = 0,
K; K = B[J]; J++) {
if (K.t == C) {
K.l.call(null);
}
}
})();
}
if (D.isIE()) {
I.attachEvent("onbeforeunload", E);
}
this.addListener(I, "unload", H);
};
asual.util.Functions = new
function() {
this.toString = function() {
return "[class Functions]";
};
this.extend = function(C, A) {
function B() {};
B.prototype = C.prototype;
A.prototype = new B();
A.prototype.constructor = A;
A.superConstructor = C;
A.superClass = C.prototype;
return A;
};
this.bind = function(F, B, E) {
for (var C = 2,
D, A = []; D = arguments[C]; C++) {
A.push(D);
}
return function() {
return F.apply(B, A);
};
};
};
asual.swfaddress.WEBAddressEvent = function(D) {
var A = asual.swfaddress.WEBAddress;
this.toString = function() {
return "[object WEBAddressEvent]";
};
this.type = D;
this.target = [A][0];
this.value = A.getValue();
this.path = A.getPath();
this.pathNames = A.getPathNames();
this.parameters = {};
var E = A.getParameterNames();
for (var C = 0,
B = E.length; C < B; C++) {
this.parameters[E[C]] = A.getParameter(E[C]);
}
this.parametersNames = E;
};
asual.swfaddress.WEBAddressEvent.INIT = "init";
asual.swfaddress.WEBAddressEvent.CHANGE = "change";
asual.swfaddress.WEBAddress = new
function() {
var ID = "",
_2f = "function",
_30 = "undefined",
_31 = asual.swfaddress,
_32 = asual.util,
_33 = _32.Browser,
_34 = _32.Events,
_35 = _32.Functions,
_36 = _33.getVersion(),
_37 = false,
_t = top,
_d = _t.document,
_h = _t.history,
_l = _t.location,
_si = setInterval,
_st = setTimeout,
_dc = decodeURIComponent,
_ec = encodeURIComponent,
_40,
_41,
_42,
_43,
_44 = _d.title,
_45 = _h.length,
_46 = false,
_47 = false,
_48 = true,
_49 = true,
_4a = [],
_4b = {},
_4c = {
history: true,
html: false,
strict: true,
tracker: "_trackDefault"

};
if (_33.isOpera()) {
_37 = _36 >= 9.02;
}
if (_33.isIE()) {
_37 = _36 >= 6;
}
if (_33.isSafari()) {
_37 = _36 >= 312;
}
if (_33.isChrome()) {
_37 = _36 >= 0.2;
}
if (_33.isCamino()) {
_37 = _36 >= 1;
}
if (_33.isFirefox()) {
_37 = _36 >= 1;
}
if ((!_37 && _l.href.indexOf("#") != -1) || (_33.isSafari() && _36 < 418 && _l.href.indexOf("#") != -1 && _l.search != "")) {
_d.open();
_d.write("<html><head><meta http-equiv="refresh" content="0;url=" + _l.href.substr(0, _l.href.indexOf("#")) + "" /></head></html>");
_d.close();
}
var _4d = function() {
var _4e = _l.href.indexOf("#");
return _4e != -1 ? _l.href.substr(_4e + 1) : "";
};
var _4f = _4d();
var _50 = function(_51, _52) {
if (_4c.strict) {
_51 = _52 ? (_51.substr(0, 1) != "/" ? "/" + _51: _51) : (_51 == "" ? "/": _51);
}
return _51;
};
var _53 = function(_54) {
return (_33.isIE() && _l.protocol == "file:") ? _4f.replace(/?/, "%3F") : _54;
};
var _55 = function(el) {
for (var i = 0,
l = el.childNodes.length,
s; i < l; i++) {
if (el.childNodes[i].src) {
_42 = String(el.childNodes[i].src);
}
if (s = _55(el.childNodes[i])) {
return s;
}
}
};
var _5a = function() {
if (_33.isIE() && _d.title != _44 && _d.title.indexOf("#") != -1) {
_d.title = _44;
if (_4c.html && _40 && _40.contentWindow && _40.contentWindow.document) {
_40.contentWindow.document.title = _44;
}
}
};
var _5b = function() {
if (!_46) {
var _5c = _4d();
var _5d = !(_4f == _5c || _4f == _dc(_5c) || _dc(_4f) == _5c);
if (_33.isSafari() && _36 < 523) {
if (_45 != _h.length) {
_45 = _h.length;
if (typeof _4a[_45 - 1] != _30) {
_4f = _4a[_45 - 1];
}
_5e.call(this);
}
} else {
if (_33.isIE() && _5d) {
if (_36 < 7) {
_l.reload();
} else {
this.setValue(_5c);
}
} else {
if (_5d) {
_4f = _5c;
_5e.call(this);
}
}
}
_5a.call(this);
}
};
var _5f = function(_60) {
this.dispatchEvent(new _31.WEBAddressEvent(_60));
_60 = _60.substr(0, 1).toUpperCase() + _60.substr(1);
if (typeof this["on" + _60] == _2f) {
this["on" + _60]();
}
};
var _61 = function() {
_5f.call(this, "init");
};
var _62 = function() {
_5f.call(this, "change");
};
var _5e = function() {
_62.call(this);
_st(_35.bind(_63, this), 10);
};
var _64 = function(_65) {
if (typeof urchinTracker == _2f) {
urchinTracker(_65);
}
if (typeof pageTracker != _30 && typeof pageTracker._trackPageview == _2f) {
pageTracker._trackPageview(_65);
}
};
eval("var _trackDefault = " + _64 + ";");
var _63 = function() {
if (typeof _4c.tracker != _30 && eval("typeof " + _4c.tracker + " != "" + _30 + """)) {
var fn = eval(_4c.tracker);
if (typeof fn == _2f) {
fn(_dc((_l.pathname + (//$/.test(_l.pathname) ? "": "/") + this.getValue()).replace(////, "/").replace(/^/$/, "")));
}
}
};
var _67 = function() {
var doc = _40.contentWindow.document;
doc.open();
doc.write("<html><head><title>" + _d.title + "</title><script>var " + ID + " = "" + _ec(_4d()) + "";</script></head></html>");
doc.close();
};
var _69 = function() {
var win = _40.contentWindow;
var src = win.location.href;
_4f = (_4c.html) ? (src.indexOf("?") > -1 ? _dc(src.substr(src.indexOf("?") + 1)) : "") : (typeof win[ID] != _30 ? _dc(win[ID]) : "");
if (_4c.html) {
win.document.title = _44;
}
if (_4f != _4d()) {
_5e.call(_31.WEBAddress);
_l.hash = _53(_4f);
}
};
var _6c = function() {
if (!_47) {
_47 = true;
var _6d = "id="" + ID + "" style="position:absolute;top:-9999px;"";
if (_33.isIE() && _36 < 8) {
_d.body.appendChild(_d.createElement("div")).innerHTML = "<iframe " + _6d + " src="" + (_4c.html ? _42.replace(/.js(?.*)?$/, ".html") + "?" + _ec(_4d()) : "javascript:false;") + "" width="0" height="0"></iframe>";
_40 = _d.getElementById(ID);
_st(function() {
_34.addListener(_40, "load", _69);
if (!_4c.html && typeof _40.contentWindow[ID] == _30) {
_67();
}
},
50);
} else {
if (_33.isSafari()) {
if (_36 < 418) {
_d.body.innerHTML += "<form " + _6d + " method="get"></form>";
_41 = _d.getElementById(ID);
}
if (typeof _l[ID] == _30) {
_l[ID] = {};
}
if (typeof _l[ID][_l.pathname] != _30) {
_4a = _l[ID][_l.pathname].split(",");
}
}
}
_st(_35.bind(_61, this), 1);
_st(_35.bind(_62, this), 2);
_st(_35.bind(_63, this), 10);
if (_33.isIE() && _36 >= 8) {
_d.body.onhashchange = _35.bind(_5b, this);
_43 = _si(_35.bind(_5a, this), 50);
} else {
_43 = _si(_35.bind(_5b, this), 50);
}
}
};
var _6e = function() {
clearInterval(_43);
};
this.onInit = null;
this.onChange = null;
this.toString = function() {
return "[class WEBAddress]";
};
this.back = function() {
_h.back();
};
this.forward = function() {
_h.forward();
};
this.up = function() {
var _6f = this.getPath();
this.setValue(_6f.substr(0, _6f.lastIndexOf("/", _6f.length - 2) + (_6f.substr(_6f.length - 1) == "/" ? 1 : 0)));
};
this.go = function(_70) {
_h.go(_70);
};
this.addEventListener = function(_71, _72) {
if (typeof _4b[_71] == _30) {
_4b[_71] = [];
}
_4b[_71].push(_72);
};
this.removeEventListener = function(_73, _74) {
if (typeof _4b[_73] != _30) {
for (var i = 0,
l; l = _4b[_73][i]; i++) {
if (l == _74) {
break;
}
}
_4b[_73].splice(i, 1);
}
};
this.dispatchEvent = function(_77) {
if (this.hasEventListener(_77.type)) {
_77.target = this;
for (var i = 0,
l; l = _4b[_77.type][i]; i++) {
l(_77);
}
return true;
}
return false;
};
this.hasEventListener = function(_7a) {
return (typeof _4b[_7a] != _30 && _4b[_7a].length > 0);
};
this.getBaseURL = function() {
var url = _l.href;
if (url.indexOf("#") != -1) {
url = url.substr(0, url.indexOf("#"));
}
if (url.substr(url.length - 1) == "/") {
url = url.substr(0, url.length - 1);
}
return url;
};
this.getStrict = function() {
return _4c.strict;
};
this.setStrict = function(_7c) {
_4c.strict = _7c;
};
this.getHistory = function() {
return _4c.history;
};
this.setHistory = function(_7d) {
_4c.history = _7d;
};
this.getTracker = function() {
return _4c.tracker;
};
this.setTracker = function(_7e) {
_4c.tracker = _7e;
};
this.getTitle = function() {
return _d.title;
};
this.setTitle = function(_7f) {
if (!_37) {
return null;
}
if (typeof _7f == _30) {
return;
}
if (_7f == "null") {
_7f = "";
}
_44 = _d.title = _7f;
_st(function() {
if ((_49 || _4c.html) && _40 && _40.contentWindow && _40.contentWindow.document) {
_40.contentWindow.document.title = _7f;
_49 = false;
}
if (!_48 && (_33.isCamino() || _33.isFirefox())) {
_l.replace(_l.href.indexOf("#") != -1 ? _l.href: _l.href + "#");
}
_48 = false;
},
50);
};
this.getStatus = function() {
return _t.status;
};
this.setStatus = function(_80) {
if (typeof _80 == _30) {
return;
}
if (!_33.isSafari()) {
_80 = _50((_80 != "null") ? _80: "", true);
if (_80 == "/") {
_80 = "";
}
if (! (/http(s)?:///.test(_80))) {
var _81 = _l.href.indexOf("#");
_80 = (_81 == -1 ? _l.href: _l.href.substr(0, _81)) + "#" + _80;
}
_t.status = _80;
}
};
this.resetStatus = function() {
_t.status = "";
};
this.getValue = function() {
if (!_37) {
return null;
}
return _50(_4f, false);
};
this.setValue = function(_82) {

if (!_37) {
return null;
}
if (typeof _82 == _30) {
return;
}
if (_82 == "null") {
_82 = "";
}
_82 = _50(_82, true);
if (_82 == "/") {
_82 = "";
}
if (_4f == _82 || _4f == _dc(_82) || _dc(_4f) == _82) {
return;
}
_48 = true;
_4f = _82;
_46 = true;
_5e.call(_31.WEBAddress);
_4a[_h.length] = _4f;
if (_33.isSafari()) {
if (_4c.history) {
_l[ID][_l.pathname] = _4a.toString();
_45 = _h.length + 1;
if (_36 < 418) {
if (_l.search == "") {
_41.action = "#" + _4f;
_41.submit();
}
} else {
if (_36 < 523 || _4f == "") {
var evt = _d.createEvent("MouseEvents");
evt.initEvent("click", true, true);
var _84 = _d.createElement("a");
_84.href = "#" + _4f;
_84.dispatchEvent(evt);
} else {
_l.hash = "#" + _4f;
}
}
} else {
_l.replace("#" + _4f);
}
} else {
if (_4f != _4d()) {
if (_4c.history) {
var lastCall = _4f;

//_l.hash = (_33.isChrome() ? "": "#") + _53(lastCall);
setTimeout( function(){
_l.hash = (_33.isChrome() ? "": "#") + _53(lastCall);
},20);

} else {
_l.replace("#" + _4f);
}
}
}
if ((_33.isIE() && _36 < 8) && _4c.history) {
if (_4c.html) {
var loc = _40.contentWindow.location;
loc.assign(loc.pathname + "?" + _4d());
} else {
_st(_67, 50);
}
}
if (_33.isSafari()) {
_st(function() {
_46 = false;
},
1);
} else {
_46 = false;
}
};
this.getPath = function() {
var _86 = this.getValue();
return (_86.indexOf("?") != -1) ? _86.split("?")[0] : _86;
};
this.getPathNames = function() {
var _87 = this.getPath();
var _88 = _87.split("/");
if (_87.substr(0, 1) == "/" || _87.length == 0) {
_88.splice(0, 1);
}
if (_87.substr(_87.length - 1, 1) == "/") {
_88.splice(_88.length - 1, 1);
}
return _88;
};
this.getQueryString = function() {
var _89 = this.getValue();
var _8a = _89.indexOf("?");
return (_8a != -1 && _8a < _89.length) ? _89.substr(_8a + 1) : "";
};
this.getParameter = function(_8b) {
var _8c = this.getValue();
var _8d = _8c.indexOf("?");
if (_8d != -1) {
_8c = _8c.substr(_8d + 1);
var _8e = _8c.split("&");
var p, i = _8e.length;
while (i--) {
p = _8e[i].split("=");
if (p[0] == _8b) {
return p[1];
}
}
}
return "";
};
this.getParameterNames = function() {
var _91 = this.getValue();
var _92 = _91.indexOf("?");
var _93 = [];
if (_92 != -1) {
_91 = _91.substr(_92 + 1);
if (_91 != "" && _91.indexOf("=") != -1) {
var _94 = _91.split("&");
var i = 0;
while (i < _94.length) {
_93.push(_94[i].split("=")[0]);
i++;
}
}
}
return _93;
};
if (_37) {
for (var i = 1; i < _45; i++) {
_4a.push("");
}
_4a.push(_4d());
if (_33.isIE() && _l.hash != _4d()) {
_l.hash = "#" + _53(_4d());
}
_55(document);
var _qi = _42.indexOf("?");
if (_42 && _qi > -1) {
var _98, _99 = _42.substr(_qi + 1).split("&");
for (var i = 0,
p; p = _99[i]; i++) {
_98 = p.split("=");
if (/^(history|html|strict)$/.test(_98[0])) {
_4c[_98[0]] = (isNaN(_98[1]) ? eval(_98[1]) : (parseFloat(_98[1]) > 0));
}
if (/^tracker$/.test(_98[0])) {
_4c[_98[0]] = _98[1];
}
}
}
if (/file:///.test(_l.href)) {
_4c.html = false;
}
var _ei = _42.indexOf(".js"),
l;
if (_42 && _ei > -1) {
while (_ei--) {
l = _42.substr(_ei, 1);
if (/(/|)/.test(l)) {
break;
}
ID = l + ID;
}
}
_5a.call(this);
if (window == _t) {
_34.addListener(document, "DOMContentLoaded", _35.bind(_6c, this));
}
_34.addListener(_t, "load", _35.bind(_6c, this));
_34.addListener(_t, "unload", _35.bind(_6e, this));
} else {
_63();
}
};
SWFAddressEvent = asual.swfaddress.SWFAddressEvent = function(A) {
SWFAddressEvent.superConstructor.apply(this, arguments);
this.target = [SWFAddress][0];
this.toString = function() {
return "[object SWFAddressEvent]";
};
};
asual.util.Functions.extend(asual.swfaddress.WEBAddressEvent, SWFAddressEvent);
asual.swfaddress.SWFAddressEvent.INIT = "init";
asual.swfaddress.SWFAddressEvent.CHANGE = "change";
SWFAddress = asual.swfaddress.SWFAddress = new
function() {
var _9e = "undefined",
_t = top,
_l = _t.location,
_a1 = this,
_a2 = [],
_a3 = [],
_a4 = {},
_a5 = asual.util,
_a6 = asual.util.Functions,
_a7 = asual.swfaddress.WEBAddress;
for (var p in _a7) {
this[p] = _a7[p];
}
var _a9 = function(_aa) {
this.dispatchEvent(new SWFAddressEvent(_aa));
_aa = _aa.substr(0, 1).toUpperCase() + _aa.substr(1);
if (typeof this["on" + _aa] == "function") {
this["on" + _aa]();
}
};
var _ab = function(e) {
if (_a3.length > 0) {
var _ad = window.open(_a3[0], _a3[1], eval(_a3[2]));
if (typeof _a3[3] != _9e) {
eval(_a3[3]);
}
}
_a3 = [];
};
var _ae = function() {
if (_a5.Browser.isSafari()) {
document.body.addEventListener("click", _ab);
}
_a9.call(this, "init");
};
var _af = function() {
_b0();
_a9.call(this, "change");

};
var _b0 = function() {
for (var i = 0,
id, obj, _b4 = SWFAddress.getValue(), _b5 = "setSWFAddressValue"; id = _a2[i]; i++) {

obj = document.getElementById(id);

if (obj) {
if (obj.parentNode && typeof obj.parentNode.so != _9e) {

obj.parentNode.so.call(_b5, _b4);
} else {
if (! (obj && typeof obj[_b5] != _9e)) {
var _b6 = obj.getElementsByTagName("object");
var _b7 = obj.getElementsByTagName("embed");
obj = ((_b6[0] && typeof _b6[0][_b5] != _9e) ? _b6[0] : ((_b7[0] && typeof _b7[0][_b5] != _9e) ? _b7[0] : null));
}
if (obj) {
obj[_b5](decodeURIComponent(_b4));
}
}
} else {
if (obj = document[id]) {
if (typeof obj[_b5] != _9e) {
obj[_b5](_b4);
}
}
}
}
};
this.toString = function() {
return "[class SWFAddress]";
};
this.addEventListener = function(_b8, _b9) {
if (typeof _a4[_b8] == _9e) {
_a4[_b8] = [];
}
_a4[_b8].push(_b9);
};
this.removeEventListener = function(_ba, _bb) {
if (typeof _a4[_ba] != _9e) {
for (var i = 0,
l; l = _a4[_ba][i]; i++) {
if (l == _bb) {
break;
}
}
_a4[_ba].splice(i, 1);
}
};
this.dispatchEvent = function(_be) {
if (typeof _a4[_be.type] != _9e && _a4[_be.type].length) {
_be.target = this;
for (var i = 0,
l; l = _a4[_be.type][i]; i++) {
l(_be);
}
return true;
}
return false;
};
this.hasEventListener = function(_c1) {
return (typeof _a4[_c1] != _9e && _a4[_c1].length > 0);
};
this.href = function(url, _c3) {
_c3 = typeof _c3 != _9e ? _c3: "_self";
if (_c3 == "_self") {
self.location.href = url;
} else {
if (_c3 == "_top") {
_l.href = url;
} else {
if (_c3 == "_blank") {
window.open(url);
} else {
_t.frames[_c3].location.href = url;
}
}
}
};
this.popup = function(url, _c5, _c6, _c7) {
try {
var _c8 = window.open(url, _c5, eval(_c6));
if (typeof _c7 != _9e) {
eval(_c7);
}
} catch(ex) {}
_a3 = arguments;
};
this.getIds = function() {
return _a2;
};
this.getId = function(_c9) {
return _a2[0];
};
this.setId = function(id) {
_a2[0] = id;
};
this.addId = function(id) {
this.removeId(id);
_a2.push(id);
};
this.removeId = function(id) {
for (var i = 0; i < _a2.length; i++) {
if (id == _a2[i]) {
_a2.splice(i, 1);
break;
}
}
};
this.setValue = function(_ce) {
if (_a2.length > 0 != 0 && _a5.Browser.isFirefox() && navigator.userAgent.indexOf("Mac") != -1) {
setTimeout(function() {
_a7.setValue.call(SWFAddress, _ce);
},
500);
} else {
_a7.setValue.call(this, _ce);
}
};
_a7.addEventListener("init", _a6.bind(_ae, this));
_a7.addEventListener("change", _a6.bind(_af, this)); (function() {
var _cf;
if (typeof FlashObject != _9e) {
SWFObject = FlashObject;
}
if (typeof SWFObject != _9e && SWFObject.prototype && SWFObject.prototype.write) {
var _s1 = SWFObject.prototype.write;
SWFObject.prototype.write = function() {
_cf = arguments;
if (this.getAttribute("version").major < 8) {
this.addVariable("", SWFAddress.getValue()); ((typeof _cf[0] == "string") ? document.getElementById(_cf[0]) : _cf[0]).so = this;
}
var _d1;
if (_d1 = _s1.apply(this, _cf)) {
_a1.addId(this.getAttribute("id"));
}
return _d1;
};
}
if (typeof swfobject != _9e) {
var _d2 = swfobject.registerObject;
swfobject.registerObject = function() {
_cf = arguments;
_d2.apply(this, _cf);
_a1.addId(_cf[0]);
};
var _d3 = swfobject.createSWF;
swfobject.createSWF = function() {
_cf = arguments;
_d3.apply(this, _cf);
_a1.addId(_cf[0].id);
};
var _d4 = swfobject.embedSWF;
swfobject.embedSWF = function() {
_cf = arguments;
_d4.apply(this, _cf);
_a1.addId(_cf[8].id);
};
}
if (typeof UFO != _9e) {
var _u = UFO.create;
UFO.create = function() {
_cf = arguments;
_u.apply(this, _cf);
_a1.addId(_cf[0].id);
};
}
if (typeof AC_FL_RunContent != _9e) {
var _a = AC_FL_RunContent;
AC_FL_RunContent = function() {
_cf = arguments;
_a.apply(this, _cf);
for (var i = 0,
l = _cf.length; i < l; i++) {
if (_cf[i] == "id") {
_a1.addId(_cf[i + 1]);
}
}
};
}
})();
};





Share this Post


                           

Comments


Fabien     Feb 24, 2009
Hi,
to avoid troubles with firefox (2 mainly to 3 version), best practice is using the flash.external.ExternalInterface.call(whatever); it will work fine for all browsers. Even coding you javascript inside an xml function for flash player 10.
About the blinking effect, since the last release of Firefox (3.02 to 3.1), the fix is not usefull and can have unwanted effects, best use the SWF Address 2.1 (works perfect unless you have the only bad version of firefox) version on old as2 project and 2.2 version on as3 flash and flex version.
Btw I love the bigspaceship work
Best regards,
A freelance flash addict
http://www.cadeboite.fr http://www.puredivision.com

Jerome     Feb 11, 2009
Saving life post ! Thank you VERY much !

Rostislav     Jan 29, 2009
Similar workaround should be available in SWFAddress 2.2. Unfortunately it introduced issues with titles and fast clicking which led to additional fixes that are currently available only in the SVN.

Steven Sacks     Jan 28, 2009
Rostislav has addressed this issue in SWFAddress 2.3, which is available in the SVN. Note that simply using a timeout can cause issues when you click the buttons quickly, something that Rostislav has also handled in 2.3.

Brian     Jan 28, 2009
I have noticed on Firefox 3 mac that while using SWFAddress pages would often blink. I noticed in the release notes that they mentioned this fix:
Build-in fix for the Firefox 3/Mac OSX blinking effect

I have yet to see if the fix works, but I'm assuming this is related to the same problem.

corbanb     Jan 28, 2009
Good post. I just updated a site to SWFAddress 2.2 to fix some of the artifacts problems i was having. But i did also noticed these other issues with External Interface and wasn't aware of the issue. Cheers!

grichie     Jan 28, 2009
I've never had any problems with ExternalInterface and SWFAddress, but I must say that there were some trouble detecting the stage's width and height and sending it outside to a javascript code. I always write a tiny Timer loop before any stage events and after the complete preloading to detect these parameters. (this bug appears only in Firefox under Mac and PC)



Speak






Submit »