Three things I can endlessly contemplate

17 02 2009

So, there is a saying that there are three things you can endlessly look at: water, fire and something else, I don’t remember )))

I would rephrase this saying for IT people, especially for PMs: I can endlessly contemplate 3 things:

- how QA post bugs
- how developers fix bugs
- how QA close bugs





Problem with Flex deeplinking in case you have multiple SWFs on one page

4 02 2009

This is my first time I encountered a situation where guys from Adobe implemented a feature in a little bit fucked up way.

I already wrote about deeplinking in Flex after I read basic tutorials on its implementation. Then my guys have implemented this solution in the application we are now developing and everything seems worked well in local environments.

But then we deployed the stuff in the remote environments where our SWFs are included into quite complex HTML pages of one CRM system. As you already guessed deeplinking didn’t work there.

We started to search why and found a pretty nice Fx JIRA issue which tells us (jesus christ !!) that the deepliking craps in case you have more then one SWFs in your HTML page and your SWF is not the first one.

We are now in the process of finding some solution. I hope we will dind out something in the net, if not we’ll have to fuck with the History.js ourselves.

If you are reading this and you are not a guy who doesn’t care please go to that  issue and vote for it. Adobe chooses issues to fix first depending on the number of votes from community.

Will add someting new when we resolve the problem.

UPD:

Max have solved the problem in following way:
there is a getPlayer() function in the History.js file which is responsible to return needed SWF object. We have modified this function so it returns not the first SWF on the page but the SWF with the specified object ID. It is not very nice fix since needed object ID is hardcoded in the function code but for our needs it suits right. Here is the modified code (pay attention to the ie/ff stuff):

function getPlayer(id) {
//history crash with multiple swfs fix
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;

var result = null;
if (isIE)
{
result = document.getElementById("your_unique_id_for_ie");
}else
{
result = document.getElementById("your_unique_id_for_ff");
}
if (result != null)
{
return result
}
// /fix
return document.getElementById("your_unique_id_for_ie");
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");
if (o.length > 0 && typeof o[0].SetVariable != "undefined") {
return o[0];
}
else if (e.length > 0 && typeof e[0].SetVariable != "undefined") {
return e[0];
}
}
}
else {
var o = document.getElementsByTagName("object");
var e = document.getElementsByTagName("embed");
if (e.length > 0 && typeof e[0].SetVariable != "undefined") {
return e[0];
}
else if (o.length > 0 && typeof o[0].SetVariable != "undefined") {
return o[0];
}
else if (o.length > 1 && typeof o[1].SetVariable != "undefined") {
return o[1];
}
}
return undefined;
}

Now about the ID:
You should specify the ID in the HTML where you embed your SWF object: your_unique_id_for_ie where ID for the object tag is specified and your_unique_id_for_ff where ID for the embed tag is specified.