gsbTrace - A browser debug trace window.Debug your SWF6 scripts in the browser.
Not many of the SWiSHmax scripts I write run in the SWiSH internal player. So I always use the "test in browser" option. And that means no internal trace() function making debugging a bit blind at times. So I developed an independent SWiSH movie to help me debug new movies - gsbTrace.
The movie, gsbTrace, is simply a scrolling text box running in it's own browser window. It uses local connections to receive data from the movie being tested and writes it to the scrolling text field. It is as simple as the internal player's trace() function, but instead of trace() you use gsbTrace().
To enable gsbTrace, the following code must be added to the movie under development.
Put it in the _root onload() section:
CODE
onload() {
// set up for gsbTrace window
outgoing = new LocalConnection();
_global.gsbTrace = function(str) {
outgoing.send( "_4gsbTraceWin", "gsbTrace", str );
};
...
}
When you are ready to test your movie, be sure to open the gsbTrace.swf first. I find it best to reduce the gsbTrace window size and push it to one side. Then, run your test movie from in SWiSH File/Test/In Browser (or the exported HTML) again resizing/repositioning the window to allow viewing both movies simultaneously. You can even upload your movie and test it from your web site.
Here is an example. First, open the gsbTrace window here:
gsbTrace.swfRemember to reduce it and move it aside. Then open the this test movie and text in browser:
Movie1.html(Note: The test movie is blank. Watch the gsbTrace window.)
This is the test movie's script so you can see how the trace is generated.
CODE
onload () {
// set up for gsbTrace window
outgoing = new LocalConnection();
_global.gsbTrace = function(str) {
outgoing.send( "_4gsbTraceWin", "gsbTrace", str );
};
gsbTrace("movie loading... " add Timer.ticks() );
onEnterFrame=function() {
if(++count>=110) delete onEnterFrame;
gsbTrace(">> "+count+" ?"+Timer.ticks());
};
}
Not much to this simple test example, but with more complicated movies it can save hours of development time.
HOW TO: - To toggle the scroll from auto to manual simply click on the text field anywhere.
- Use the browser window 'refresh' button to clear the text field.
- Resize as needed and the scrolling text field will adjust.
HINT: Create a new .swf file with just the gsbTrace code from above and save it as a template.
Then use FILE/New From Template to start new projects.
NOTE: Following testing and before you finally publish your movie for real, you should comment out all of the gsbTrace code/statements.
Project zip file attached: (7k)
- gsbTrace.swi
- gsbTrace.swf
- Movie1.swf
- Movie1.swi