Paul E
Paul E

Reputation: 157

Flash ActionScript - Trace from background Worker

Is it possible at all, or traces are part of the API which is not avalible from background Worker?

Consider this code:

public class Main extends Sprite {
  public function Main(container : DisplayObjectContainer = null) 
  {  
    if(Worker.current.isPrimordial) {
      trace("isPrimordial");
      var m_worker : Worker = WorkerDomain.current.createWorker(this.loaderInfo.bytes);
      m_worker.start();
    }
    else {
      trace("is NOT Primordial");
    }
  }

The string "is NOT Primordial" does not appear, however I do see that m_worker.state is "WorkerState.RUNNING".

Some UPDATE: The main thread works and racts to events, however it appears like the backgroung worker does not start until I desconnect the debugger.

And if it is possible, how do I setup the fdb to show these logs?

PS. Im using flash standalone debug player 13 with latest FDT and Apache Flex 4.12.1 SDK.

Upvotes: 1

Views: 470

Answers (2)

Paul E
Paul E

Reputation: 157

Ok, so the results for now are:

The background thread (Worker) can write traces with no problems at all if the debugger is not attached, for example if we are using flashlog.txt for the output (output to file).

What is required is: flash debug player (me used v. 14 stand alone and firefox versions).

The setup for using text file as output discussed here: http://helpx.adobe.com/flash-player/kb/configure-debugger-version-flash-player.html http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html

Correct location of mm.cfg on modern operating systems (and not on Win95!) discussed here: https://forums.adobe.com/thread/1218258

For me the output to file started to work only after the flashlog.txt file was created by some 3rd party tool (I used Vizzy), but probably it is a permission problem of flasho n windows 8 and the file just can be created manually.

Detailed discussion of the flash traces topic (althoug a little old, but mostly still relevant) is here: See trace() of Flash when running in browser

Thanks everyone for help.

Upvotes: 2

BotMaster
BotMaster

Reputation: 2223

Create a static Log class that output it's log to trace. Use this log class in your main thread and in your worker. Only the main thread log definition will be used allowing to trace from anywhere.

Upvotes: 0

Related Questions