Last Good Quote: Son's are the seasoning on our lives. - Someone on Facebook

Monday, November 26

Flash or Javascript

This is a follow up post to "Flash or Javascript".

I'm happy to say the bugs that were causing the game to not work in Firefox were very minor.

I have fixed them and the game is now 100% compatible with IE and Firefox.

The problem occurred when I was using a custom attribute within an HTML tag. For example a tile has a div on it and the div has an attribute "isWalkable"

--div class="tile" id="tile_x_y" iswalkable="Y"--


I would use the following javascript to access and set this attribute:

if(document.getElementById("tile_x_y").isWalkable == "Y")
{
//....blah, blah, blah
document.getElementById("tile_x_y").isWalkable = "N";
}
I changed this to the following:

if(document.getElementById("tile_x_y").getAttribute("isWalkable") == "Y")
{
//....blah, blah, blah
document.getElementById("tile_x_y").setAttribute("isWalkable", "N");
}

I'm hoping that this works in Opera but at this point less then 1% of my users use that browser so I'm forgoing compatibility on it.

0 comments:

Post a Comment

Followers