UPDATE: You know it’s time to stop working when the bugs you think you see, turn out to be all in your head -you know, like a crazy person? Anyway, shortly after I posted this I got a hit back on a post I made at the adobe forums and I feel stupid. I had a semi colon at the end of the second for loop which was screwing everything up. You can see it below. Bastard.
I had to pull a bunch of stuff apart for then next change and I’m having trouble getting it back together. I’ll put up the buggy version so you can play with it, and see what I’m talking about. My current problem is in the following bit of code:
public function broadcast():void { trace("first loop"); for (var Q:String in kid) { trace(Q + " => " + kid[Q]); trace(Q + " => " + connectList[Q]); } trace("second loop"); for (var i:String in kid); { trace(i + " => " + kid[i]); trace(i + " => " + connectList[i]); kid[i].engine(connectList[i]); } } |
You see those two for..in loops? Well they output different things. Even though they are the same. Here’s what they output.
first loop 0 => [object LED] 0 => 2 1 => [object Math_Add] 1 => 0 2 => [object Math_Multiply] 2 => 0 second loop 2 => [object Math_Multiply] 2 => 0
See, the second one just outputs the last entry. If I put that kid[i].engine line in the first loop, it breaks that loop. So it’s something in the engine, but I don’t understand why the trace function, which it comes to first, doesn’t spit out the first entry. So here’s it is. Some new features: the lines light up if you hover over them and you can kill them by clicking on them. This should kill the relationship and actually works in the case of the LEDs and buttons, but not the math stuff for some reason…