Flash? Pure Evil
I’ve been working on adding support for a few hours tonight, when I ran into the problem that eval() in ActionScript cannot compute anything. That’s right, the only thing it is good for is for referencing variables! Like we couldn’t do that in a better way already!
Anyhow, I needed eval() so you can configure filters on the client side. Therefore, my own implementation:
private static function eval(str) {
var as;
if(str.charAt(0) == '{') { // Ah, we need to create an object
as = {};
str = str.substring(1, str.length - 1);
var $ = str.split(',');
for(var i = 0; i < $.length; i++) {
var $1 = $[i].split(':');
as[$1[0]] = sIFR.eval($1[1]);
}
} else if(str.charAt(0) == '"') { // String
as = str.substring(1, str.length - 1);
} else if(str == 'true' || str == 'false') { // Boolean
as = str == 'true';
} else { // Integer
as = parseInt(str);
}
return as;
}
Eat that, ActionScript!
Oh, and filters seem to be working. Check out the demo and download the latest nightly. Fun!
P.S. I’m going to be in Copenhagen from Wednesday until Sunday for Reboot. If you’re there, say hi!




Not a big deal, but I thought you’d like to know that Google Reader isn’t decoding some of the entities in your entries. Specifically, the apostrophes (’)
And as a user of Linux on AMD64, yes, Flash is evil. I take that back. Flash isn’t inherintly evil, but people who don’t understand the concept of progressive enhancement (or at least graceful degredation) are evil, and Flash is guilty by association.
Evan | 30 May 2006, 00:33 | link
Well, in this case it’s probably ActionScript which is evil. Nonetheless, I’ve run into a number of issues working on sIFR, and it’s just as annoying – if not worse – than cross browser problems.
Mark Wubben | 30 May 2006, 07:30 | link
new Boolean(‘true’) isn’t quite the same as true. I would change that line to str == ‘true’.
Sjoerd Visscher | 30 May 2006, 10:49 | link
Ah, good point Sjoerd. Magic Boolean strikes again.
Mark Wubben | 30 May 2006, 13:36 | link
Nice, although when selecting sIFR’ed headers, they become unreadable. Is this a player and/or filter ‘feature’?
Owen van Dijk | 12 June 2006, 19:41 | link
This appears to be because of the knockout effect, but I’ll be doing some more research.
Mark Wubben | 12 June 2006, 20:01 | link
Yea, I think that the highlighting effect on the “New agreement creates Myriad opportunities for Fruitiger, sans-serifs” is due to the specific filter used, although I wouldn’t know what you could do to solve it.
Jeph | 14 June 2006, 23:33 | link