Content

Bill Gates Touched My Mac Book Pro

Tracing in FlashDevelop from AS3

Tuesday 1 August 2006 - Filed under Flash

Someone who was using my AS3 FlashDevelop Templates just asked how they could trace to the output panel in FlashDevelop. It just took a few minutes to come up with a solution, so I’ll post it here for everyone. Just create the following class:

package org.flashdevelop.utils {
import flash.system.fscommand;

public class FlashOut3
{
public static function trace(msg:Object):void
{
fscommand(“trace”, msg.toString());
}
}
}

and pop it in the folder:

C:/Program Files/FlashDevelop/Tools/

Then replace the compile target in your build.xml with the following:

< target name="compile">
< exec executable="${flex2.dir}/${compiler}">
< arg line="-source-path='C:/Program Files/FlashDevelop/Library'" />
< arg line="-default-frame-rate=${framerate}" />
< arg line="-default-background-color=0x${background.color}" />
< arg line="-default-size ${width} ${height}" />
< arg line="'${basedir}/${source.dir}/${source.file}'" />
< arg line="-o=${output.file}"/>
< /exec>
< /target>

Or you can just add in that third line there, with the -source-path argument.

Now, in any class where you want to trace something, you’ll have to import the FlashOut3 class:

import org.flashdevelop.utils.Flashout3;

And then you can trace to the output panel like so:

Flashout3.trace(“hello world”);

2006-08-01  »  keith

Talkback x 6

  1. Mike J
    1 August 2006 @ 7:42 am

    Nice work Keith! Your work on getting the AS3 + FD has been great. =)

  2. kp
    1 August 2006 @ 8:19 am

    Oh, I should mention that this only works if you set your launchmethod to tab. If the swf is playing in the standalone player or browser, there’s no way FD can know about it. Next is to hack the FlashConnect class into an AS3 version. That will take a bit more work though. :)

  3. Elango
    1 August 2006 @ 8:59 am

    Works Great!! Thanks a lot..

    Elan

  4. todd anderson
    1 August 2006 @ 10:05 am

    nice work keith.
    i had a little solution set up using XPanel ( http://www.ajaxmaker.com/xpanel/xpanel.htm ) – once you download the AS3 source, you have to change the imports from util to utils and it works fine.i prefer launching it within a browser over the tab in FD. I also had it open during init, so it was listening by the time it got to compile.

  5. kp
    1 August 2006 @ 10:43 am

    Nice find, Todd.

    When using FlashOut3, I find it’s useful to add a little function to your class:

    private function trace(msg:Object):void
    {
    FlashOut3.trace(msg);
    }

    This allows you to call trace(“hello world”) directly.

  6. BIT-101 Blog » Blog Archive » Tutorial: AS3 in FlashDevelop
    6 August 2006 @ 11:27 am

    [...] http://www.bit-101.com/blog/?p=843 [...]

Share your thoughts

Re: Tracing in FlashDevelop from AS3







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>