[SOLVED] FP.watch, what am I doing wrong?


(subtank) #1

This seems so simple that I’m almost too embarrassed to ask. I’m supposed to be able to track values with this thing, right?

FP.watch(xVelocity);

This just does nothing. I can get FP.log to work no problem, so I don’t know what I’m doing wrong here. Do I need to pass this data along in a special format, or am I misunderstanding FP.watch completely? I’m assuming it displays additional properties under your X and Y values (the ones that appear in the debug window).

All I want to do is track some physics numbers, but no matter what parameters I shove into this thing, I can’t get them to display. It’s driving me absolutely crazy.


(Justin Wolf) #2

As far as I know, you pass the property you want to watch as a string. So in your case, you’d do FP.watch("xVelocity"). And I believe you only have to call it once, and it will be added to an array of properties to watch on that object. You’re right in assuming that it displays the properties under the X/Y values in the debug panel. You’d also have to verify that xVelocity is a public variable, as the console won’t be able to detect private variables.


(subtank) #3

Thanks for the response.

Long story short, I’m an idiot and put FP.watch in the constructor function. It doesn’t work there, ever – probably because it’s looking for something that isn’t on the stage yet. It has to be in added() to work. The only reason FP.log was working was because I had it in update(). Anyway, problem solved. If anyone else is as foolish as I am, here’s the solution:

override public function added():void {
	FP.watch("myVar");
}

Good call on the public thing BTW. This didn’t end up being the case, but I could totally see myself trying to use private vars.