My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 20, 2009 by sectore
Labels: Phase-Implementation, Phase-Deploy, Featured
ThunderBoltAS3  
ThunderBolt AS3 for logging ActionScript 3 projects (Flex 2/3/4, AIR, Flash 9-10)

ThunderBolt AS3

ThunderBolt AS3 is a lightweight logger extension for Flex 2/3/4 and Flash ActionScript 3 applications using Firebug within Firefox as simple as possible.

It’s open source and based on the Mozilla Public License 1.1.

Using Flex Builder

1) In Flex Builder add the ThunderBoltAS3_Flex.swc as your library file (Flex Builder -> Your Project -> Properties -> Flex Build Path -> Library Path -> Add SWC) or use the package located in org.osflash.thunderbolt

2a) Using ThunderBolt's Logger.as instance:

import org.osflash.thunderbolt.Logger;

var myNumber: int = 5;
var myString: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);

2b) Or using ThunderBoltTarget.as based on the Flex Logging Framework:

<!--
	Using ThunderBoltTarget
	
	You can disable the time, level or category as follow:				
    includeTime = "false";
    includeLevel = "false";
    includeCategory = "false;"
    
    To use the TunderBolt AS3 Console set: 
    console="true"
    
    Using filters:          
	filters="{ ['ThunderBoltTargetExample'] }"
	
	Hide or show categories  
	includeCategory = true
	includeCategory = false
-->
	
<tb:ThunderBoltTarget id="tbTarget"
	xmlns:tb="org.osflash.thunderbolt.*"
	/>

Using Flash CS3

1) Create a new folder called "ThunderBoltAS3" in the Flash CS3 components folder located here

OS X: Mac HD:Application:Adobe Flash CS3:Configuration:Components

WIN: C:\Program Files\Adobe\Adobe Flash CS3\{lang}\Configuration\Components

Copy ThunderBoltAS3_Flash.swc to it.

2) Open Flash IDE and select on the Component Panels (Windows -> Components) the Options menu to refresh its view ("Reload"). You'll see a folder named "ThunderBoltAS3" within the Component Panel. Open this folder and drag the component called "Logger" to the Stage. Remove it. Then you'll have a ThunderBoltAS3 component in your library.

3) Using ThunderBolt's Logger.as instance:

import org.osflash.thunderbolt.Logger;

var myNumber: int = 5;
var myString: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);

Using Flash CS4

1) Link the SWC called ThunderBoltAS3_Flash.swc to your project using Flash CS 4:

File -> Publish Settings -> Flash -> Settings -> Library path -> Browse to SWC file (red icon) -> Select "ThunderBoltAS3_Flash.swc" (which you have downloaded + saved before) -> Press "Ok"

2) For testing open Action window (Window -> Actions) and type the following lines:

import org.osflash.thunderbolt.Logger;

var myNumber: int = 5;
var myString: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);

3) Publish movie (File -> Publish) and open generated HTML within Firefox

Additional features

1) Get the info about the memory in use by Flash Player:

Logger.info(Logger.memorySnapshot());

2) Stop logging - which hides all outputs to Firebug:

// stop logging
Logger.hide = true;
// resume logging
Logger.hide = false;

3) Info about the version you're using:

Logger.about();

Any issues with...

1) ...Flash Player security sandbox?

If you have any security issues with the Flash Player security sandbox set on your HTML page the value of the "allowScriptAccess" parameter to "always".

Note: "For SWF files running locally, calls to ExternalInterface.call() is sucessful only if the SWF file and the containing web page (if there is one) are in the local-trusted security sandbox. Calls to these methods fail if the content is in the local-with-networking or local-with-filesystem sandbox." (@see: Flash Player security: Controlling access to scripts in a host web page)

For more information check Adobes Flex 3 Developer's Guide: "About ExternalInterface API security in Flex" and "Flash Player security: Security sandboxes"

2) ...receiving empty messages in Firebugs console?

Please reload your site and try it again. It could be an issue connecting Firebug using ExternalInterface.

3) ...any else?

Feel free to post your issues on ThunderBolts Issue page or describe it on Google Thunderbolt Group

Tutorials / Tips 'n' Tricks

You'll find tutorials, tips and tricks for using ThunderBolt AS3 on WS-Blog.

Live examples

Live examples of ThunderBolt AS3 v.1.0 on WS-Blog

Download source

Grab here the latest ThunderBolt AS3 package.

Author

Jens Krause (aka sectore)


Comment by andreiashu, Oct 18, 2007

Great !!! 10x so much people !

Comment by dsgirard, Feb 02, 2008

well that's just freakin' rad.

installed in 2 minutes.

yum!

Comment by dsgirard, Feb 02, 2008

sorry, I just have to gush some more...

this is seriously a quantum leap in my runtime .swf debugging experience...much appreciated!

Comment by linmarc, Aug 04, 2008

This is a very very handy tool. I use FDT+flex_sdk compiler. The console in eclipse can't display "trace()". ThunderBolt? helps me a lot. Many thanks~ Just few requests to improve this tool to a super super handy one. 1.make the ThunderBolt? As3 Banner in the console smaller. My small screen doesn't fit sometimes. 2.Is that possible to make the console always on top? Thanks again~ (Just ignore this message if it is not appropriate.)

Comment by sectore, Aug 23, 2008

@linmarc: Check out the latest version of ThunderBolt? AS3 Console v.2.1 which includes your needed features.

Comment by robmccar...@yahoo.co.uk, Oct 23, 2008

This is a quality tool. Exceptional work my friend

Comment by rvraaphorst, Nov 27, 2008

I didn't get it to work with Flash CS4 and Firefox 3 / Firebug 1.2.1 following the steps in "Using Flash CS3".

Comment by sectore, Nov 29, 2008

@rvraaphorst: Thanks for your comment. I have updated the wiki for using Flash CS4. Check it out ;)

Comment by andresalrevez, Aug 25, 2009

how can i implement this using the as2 version?

Comment by IcebergWTF, Nov 10, 2009

I'm new to flex, please help me how to get ThunderBolt? work under flex 3.4 free SDK. Thanks!

Comment by sectore, Nov 14, 2009

IcebergWTF, you will find a Flex 3 related example here: http://code.google.com/p/flash-thunderbolt/source/browse/#svn/trunk/as3/examples/flex Check it out ;)


Sign in to add a comment
Hosted by Google Code