« Learning Flex | Main | Drilling Down into Data »

Where are the trace statements?

This probably belongs under the "to embarrassed to mention" category, but I will post it anyway.

One of the first things I did after installing Flex was to try to get the trace method working. I love trace and have found it invaluable when I learning a language. I can do some quick runs to test my syntax or understanding of a piece of code. And of course you can keep an eye on your program to make sure everything is working as you expect.

The FAQ on the labs wiki has a nice little note informing you that you must import the trace package before the method can be used..

Ok, no problem. I create a new ActionScript project that looks like this:

package {
import flash.display.MovieClip;
import flash.util.trace;

public class traceTest extends MovieClip {
public function traceTest() {
trace("Its nice to see you!");
}
}
}


I then hit the green run button at the top of Flex interface. A few seconds later my browser pops up with an empty Flex background. No trace on the browser so I flip back to Flex, and nothing is there either. I see a nice little console window tab that would be an ideal place to show me my trace statements, but it says "A console is not available."

So I head to google and start searching for Action 3.0 trace. I find tons of information all telling me that I need to import the trace package before I can use the command. I know this. Finally, I found a note on a blog that let me know you need to view your program in debug mode to see your trace statements. You can do this by right clicking in the CODE (in case you are tracing from a Flex app) view and selecting "Debug As -> Flex Application".

With that tasty bit of knowledge I was able to see my trusty trace statements!

I imagine this would be obvious to many people (particularly Eclipse users) but it took a good bit of my time to figure it out. It does make sense that it works this way... now that I know about it.

Does anyone know of a MoveableType plugin that will let markup ActionScript and/or MXML with "code" tag or something similar?

TrackBack

TrackBack URL for this entry:
http://www.evilfree.com/cgi-bin/mt/mt-tb.cgi/2