Hok's Macromedia Flash Blog

macromedia flash actionscript scripting, php, remoting, webservices, c#, javascript

Ads

Search

traceMessages: revised

If you want to know which method is called in which
order. And you also want to know who is the caller
of the current method. Than you normally have to
populate your Script with many traces.




I think we have know an good solution for this problem.
I have revised the traceMessages-method, and now
we can solve the problem really easy.
We simply include the traceMessages.as and put the
following line in our script:
#include "traceMessages.as"
traceMessages(_root);

And now we get informed, when an method is called
like this:


[call] scrollIt (called by startUpScroller)
[call] getScrollPosition (called by scrollIt)
[call] setScrollPosition (called by scrollIt)
[call] executeCallBack (called by setScrollPosition)
[call] executeCallBack (called by executeCallBack)
[call] onScrollBarChangeRight (called by executeCallBack)
[call] getScrollPosition (called by onScrollBarChangeRight)

In this case we used _root as base for the treeTrace-method,
but we can also use any other object which aggregated methods
we like to observe.
view
download

Posted by hOk at May 15, 2003 11:08 PM

Comments (7)

Hi!

It's a great idea.
I'm testing quickly and I found some problems, but, I continue testing and warching how behaves it.

thanks.

C.

Posted by Carlos at May 26, 2003 12:03 PM

Wow! Now that's a damn cool and useful piece of code :) Great work!

Posted by Tim at June 18, 2003 05:17 PM

Very nice!!!
however it fails to trace functions created using reference. i.e. functions implemented as methods of an object / class.

MyClass.prototype.init = function(){
// do some
}

the above doesn't trace :-(
I'm going to have a look at your code to see if this is fix-able, however I'm feeling that is might be impossible because it uses references to functions, hard to trace back...

Posted by Corstiaan at June 27, 2003 02:08 PM

You can use the function direct with the
prototype:

traceMessages(MyClass.prototype);

regards, Holger

Posted by hOk at June 27, 2003 03:35 PM

DUH, thnx! ;-)

Posted by Corstiaan at July 17, 2003 11:30 AM

I got error
" Error opening include file traceMessages.as: File not found.
traceMessages(_root);"
whats that have any idea

Posted by alnoor at September 26, 2003 08:35 PM

great! next, you should make a component with easy drag&drop that attaches itself to whatever element you drop it into. (some kind of visual marker when its alive on the timeline). that would be nice.

Posted by coby at November 16, 2003 01:20 AM


Name:


Email Address:


URL:


Comments:



You can use <code>code that should be highlightned</code> to highlight code!
Optionally you can use the attribut language="php|perl|java" within the code tag, otherwise
actionscript-highlightning will be used.

New Place