3
votes

This is more a general question and not a 'help fix code' question:

Goal
Parent swf a.swf loads external child b.swf

Child swf has trace statements: [timestamp][log level][class] msg

is it possible for the parent swf to 'trap' those trace statements and use them as a string?

Purpose:
Parent swf has logging functions (outputs through to javascript for extra logging functionality), I'd love to be able to push child trace statements up through the parent.

Side Notes:
Yes, we're able to see the child's traces in the flashlog (using apps like vizzy) but I'm wondering if it's possible to 'bubble' those child trace statements to parent.

I know of debugging tools that basically 'wrap' your compiled swf for additional debugging but is this possible without those?

Thanks in advance

3
Could you pass what the child would otherwise trace as something else to the parent and have the parent trace out the return?IAmMearl
You'll need a custom Logger.Jason Sturges

3 Answers

0
votes

I'm pretty sure it can't be done with pure AS3 like you ask unfortunately.

0
votes

If you think about what a trace does, you'll see that this really isn't possible. It outputs to the console or to a log file if you have it set up that way in your mm.cfg. It's a feature built into the player runtime. It's got nothing to do with parents and children and object hierarchy.

I think Michael E's comments are going to be about the best you can do.

0
votes

It used to be possible in AS2 and looks like it may be possible in AS3 if you look into undocumented Trace class http://hg.mozilla.org/tamarin-central/file/e774dfe22b39/extensions/Trace.as . But this is unreliable and may be changed. Of course, the class is only available in debug builds. Specifically, you could setListener() your function and change the logging level to the preferred value, so that it uses that function instead of writing to file.

But I would advise you, if you really want to advance with it - look into fdb sources, it already knows what SWF is loaded, what source file is the method coming from etc. If all you want is to modify its output to print the source - perhaps it's a very tiny patch you are talking about.