Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion src/uk/msfx/utils/tracing/core/TrCore.as
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* Tr.ace() by MSFX Matt Stuttard Parker
* Version 2.0
* 10.06.2012
*
* proposition by Peter Delvaux
* 31.07.2012
*
* Copyright (c) MSFX Matt Stuttard Parker
*
Expand Down Expand Up @@ -31,6 +34,7 @@
**/
package uk.msfx.utils.tracing.core
{
import flash.external.ExternalInterface;
import flash.text.TextField;
import flash.ui.Keyboard;
import flash.utils.getQualifiedClassName;
Expand Down Expand Up @@ -234,6 +238,8 @@ package uk.msfx.utils.tracing.core
// start trace for Object
out(prefix + "Begin Object Trace", user, withinClass, arrayAndObjectLinebreaks);

// a count variable, if no properties were found, you can display a message.
var count:uint;
// loop over object tracing each property
for (var p:* in output)
{
Expand All @@ -254,7 +260,13 @@ package uk.msfx.utils.tracing.core
{
out(prefix + "- [" + p + "] => " + output[p], user, withinClass);
}

count++;
}

if(count == 0){
// no properties where found.
out(prefix + "- No properties where found in: ", user, withinClass, arrayAndObjectLinebreaks);
out(prefix + "- " + output, user, withinClass, arrayAndObjectLinebreaks);
}

// end trace for Object
Expand Down Expand Up @@ -305,6 +317,11 @@ package uk.msfx.utils.tracing.core
// trace the users output
trace(traceStr + output);

// if there is an external interface, log to the javascript console.
if(ExternalInterface.available){
ExternalInterface.call("console.log", traceStr + output);
}

// update log
_log += ((traceStr + output) + String.fromCharCode(Keyboard.ENTER));

Expand All @@ -317,6 +334,11 @@ package uk.msfx.utils.tracing.core
// otherwise just trace every users output
trace(traceStr + output);

// if there is an external interface, log to the javascript console.
if(ExternalInterface.available){
ExternalInterface.call("console.log", traceStr + output);
}

// update log
//_log += ((traceStr + output) + "\n");
_log += ((traceStr + output) + String.fromCharCode(Keyboard.ENTER));
Expand All @@ -329,6 +351,10 @@ package uk.msfx.utils.tracing.core
if (_useLineBreaks)
{
trace("");
// if there is an external interface, log a linebreak to the javascript console.
if(ExternalInterface.available){
ExternalInterface.call("console.log", "");
}

// update log
_log += "\n";
Expand All @@ -341,6 +367,10 @@ package uk.msfx.utils.tracing.core
if (endWithLineBreak)
{
trace("");
// if there is an external interface, log a linebreak to the javascript console.
if(ExternalInterface.available){
ExternalInterface.call("console.log", "");
}

// update log
_log += "\n";
Expand Down