Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash trace output in firefox, linux

I'm developing an applications which I've got running on a server on my linux desktop. Due to the shortcomings of Flash on Linux (read: too hard) I'm developing the (small) flash portion of the app in Windows, which means there's a lot of frustrating back and forth. Now I'm trying to capture the output of the flash portion using flash tracer and that is proving very difficult also. Is there any other way I could monitor the output of trace on linux? Thanks...

like image 279
danwoods Avatar asked Jan 23 '23 15:01

danwoods


2 Answers

Hope this helps too (for the sake of google search i came from):

In order to do trace, you need the debugger version of Flash Player from http://www.adobe.com/support/flashplayer/downloads.html (look for "debugger" version specifically - they are hard to spot on first look)

Then an mm.cfg file in your home containing

ErrorReportingEnable=1 TraceOutputFileEnable=1 MaxWarnings=50

And then you are good to go - restart the browser. When traces start to fill in, you will find the log file in

~/.macromedia/Flash_Player/Logs/flashlog.txt

Something like

tail ~/.macromedia/Flash_Player/Logs/flashlog.txt -f

Should suffice to follow the trace.

like image 61
tm_lv Avatar answered Feb 01 '23 05:02

tm_lv


A different and mind-bogglingly simple workaround that I've used for years is to simply create an output module directly within the swf. All this means is a keyboard shortcut that attaches a MovieClip with a textfield. All my traces go to this textfield instead of (or in addition to) the output window. Over the years I've refined it of course, making the window draggable, resizable, etc. But I've never needed any other approach for simple logging, and it's 100% reliable and reusable across all platforms.

[EDIT - response to comment] There's no alert quite like javascript's alert() function. But using an internal textfield is just this simple:

ACTIONSCRIPT 1 VERSION


(See notes at bottom)

/* import ExternalInterface package */
import flash.external.*;

/* Create a movieclip for the alert. Set an arbitrary (but very high) number for the depth
 * since we want the alert in front of everything else.
 */
var alert = this.createEmptyMovieClip("alert", 32000);
/* Create the alert textfield */
var output_txt = alert.createTextField("output_txt", 1, 0, 0, 300, 200);
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
/* Set up drag behaviour */
alert.onPress = function()
{
    this.startDrag();
}
alert.onMouseUp = function()
{
    stopDrag();
}

/* I was using a button to text EI. You don't need to. */
testEI_btn.onPress = function()
{
    output_txt.text = (ExternalInterface.available);
}

Notes: This works fine for AS1, and will translate well into AS2 (best to use strong data-typing if doing so, but not strictly required). It should work in Flash Players 8-10. ExternalInterface was added in Flash 8, so it won't work in previous player versions.

ACTIONSCRIPT 3 VERSION


var output_txt:TextField = new TextField();
addChild(output_txt);
output_txt.text = (String(ExternalInterface.available));

If you want to beef it out a bit:

var alert:Sprite = new Sprite();
var output_txt:TextField = new TextField();
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
output_txt.width = 300;
output_txt.height = 300;
alert.addChild(output_txt);
addChild(alert);

alert.addEventListener(MouseEvent.MOUSE_DOWN, drag);
alert.addEventListener(MouseEvent.MOUSE_UP, stopdrag);

output_txt.text = (String(ExternalInterface.available));

function drag(e:MouseEvent):void
{
    var alert:Sprite = e.currentTarget as Sprite;
    alert.startDrag();
}

function stopdrag(e:MouseEvent):void
{
    var alert:Sprite = e.currentTarget as Sprite;
    alert.stopDrag();
}

[/EDIT]

like image 34
Wikiup Avatar answered Feb 01 '23 06:02

Wikiup