Novemberborn, Straight lines circle sometime

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!

link | sifr3 | 29 May 2006, 21:41


Comments

  1. 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

  2. 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

  3. 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

  4. Ah, good point Sjoerd. Magic Boolean strikes again.

    Mark Wubben | 30 May 2006, 13:36 | link

  5. 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

  6. 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

  7. 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

Leave your comment

Please keep it polite and on topic. Yes, your e-mail address is required, but it's kept private. HTML is not allowed in the comments but you can use Markdown. Non-contributing comments run the risk of being removed. Especially if the website seem “fishy”. Spammers, beware.

(required)
(required, kept private)
(optional, but let's share it!)
(required)

Remember my details


Novemberborn: Extra

About the author

Mark Wubben is a hacker/writer in Enschede, the Netherlands.

Read more about Mark...

Go to

Jobs (NL)

Xopus zoekt programmeurs! Verbeter de code en win!

Please donate

If you like sIFR, please consider making a donation so I can spend more time on it. Thank you.

sIFR Documentation

See the documentation for sIFR 2 and sIFR 3.

Subscribe