Marcos is Currently...
- San Fran to Yellowstone overland on a front cover "assignment" for Flipboard ;) http://post.ly/uRDH | 3 days ago
- @jackiefree hiii! | 5 days ago
- @kkfactory 久しぶり!ありがとう! | 6 days ago
- @MCHammer btw, this is the App I was telling you about today: it's called iRhyme, and done by @charlietuna http://j.mp/9aoc9u | 1 week ago
shared items in Google Reader
- Cat-trashing lady outed by internet in less than 24 hours | 2 weeks ago
- Fuck You by Cee-Lo | 2 weeks ago
- The timeless design of National Geographic | 2 weeks ago
- Pancake flipping robot | last month
- Ugur Derinogullu | last month
- 5 Porcelain Table Pieces By Aldo Bakker | last month
- Victorian Star Wars portraits | June 2010
- Place, Space and the Mobile Interface | June 2010
- Apple, AT&T sued over iPad data plan change | June 2010
- Alexis Marcou | June 2010
recent photos on flickr
recent trips
- Returned from a trip to Prescott. | February 2010
- Started a trip to Prescott. | February 2010
- Returned from a trip to Los Angeles. | October 2009
- Started a trip to Los Angeles. | October 2009
- Returned from a trip to New York. | February 2009
news / Debugging AS3 with firebug's console
March 25, 2007
Debugging AS3 with firebug's console
Most probably you've already heard about firebug, if you haven't, I really recommend you go give it a spin right now.
Basically, firebug let's you lift the hood in your browser and see pretty much everything that's happening in there. It lets you edit, and monitor all HTML, CSS, Javascript live in any web page - it even lets you edit those objects on the fly!
It also gives you a fantastic console that lets you expose information about what's flowing through your scripts. Adding a global variable named "console" it exposes many methods that allow you to write to the Firebug console.
The really cool thing is that from flash you can call "console" using ExternalInterface, and any object you pass will be dumped as if it was a javascript object.
try it out:
ExternalInterface.call("console.log",{foo:123,bar:"da",boo:{da:12,beh:[123,145,"dfa",{fa:[0,1,2,4,5]}]}});
and you will see the output in the image above.
To save you some time and make things cleaner, here you will find an AS3 Class that exposes the console object to any of your Actionscript/flex applications.
All methods are static so you don't need to instantiate the class.
From actionscript, all you need to do now is:
Console.log({foo:123,bar:"da",boo:{da:12,beh:[123,145,"dfa",{fa:[0,1,2,4,5]}]}});
I guess the only drawback for this is that this will bong out if you are trying to dump an object with circular references, or your object is too big. - I can't find out what's the size limit right now, but I've seen it throwing an exception when the objects I passed where too complex.
In case you need something more robust to debug your code, then I really recommend you try out FlexBuilder's debugger.
download: Console.as




















Comments
on February 8, 2009, 1:25 am Robert said
Hi, if you could provide working link for console.as since link http://www.marcosweskamp.com/blog/docs/Console.as is not working.
on May 12, 2009, 9:44 pm calvin said
Your links are dead for Console.as , thanks for the article though useful this method especially since it seems soooooooooo freakin hard to get simple trace stuff coming out in the various non flash dev platforms.
on July 16, 2009, 7:52 am marcos said
OOps! Sorry, should be updated now. thx for your comments!
on July 13, 2010, 3:02 am essay topics said
thanks for code!it very help me in updating my site!
on July 15, 2010, 12:56 pm dress said
2010 new styles A-line Wedding Dresses,Beach Wedding Dresses,Evening Dresses,Prom Dresses on sale\nevening dresses
on August 8, 2010, 2:51 pm HayesSIMONE20 said
Every body acknowledges that life seems to be high priced, nevertheless different people require money for various things and not every man gets big sums money. Thence to receive quick loans or just auto loan should be good solution.
on August 16, 2010, 11:57 am nhl jerseys wholesale said
I wanted to thank you for this excellent read!! I definitely enjoyed every little bit of it. I have you bookmarked your site to check out the new stuff you post.
on August 16, 2010, 4:40 pm giuseppe zanottigiuseppe zanotti said
Thanks for a great time visiting your site. It\'s really a pleasure knowing a site like this packed with great information.
on August 16, 2010, 4:42 pm air max 360 said
Your website is great. When is the next post comming on this topic.I\'m happy I found this blog, hope you can come to exchange my website I am a novice!
on August 16, 2010, 4:45 pm macbook pro 13 inch said
Admiring the time and effort you put into your blog and detailed information you offer! \nWhat a great post. I have to say I really enjoyed reading it. Thanks!
on August 16, 2010, 4:47 pm ping rapture v2 driver said
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me.\nI admire the valuable information you offer in your articles. I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else!
on August 16, 2010, 4:48 pm ping rapture v2 driver said
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me.\nI admire the valuable information you offer in your articles. I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else!
on August 16, 2010, 6:12 pm cell phone battery said
That\'s great, I never thought about Nostradamus in the OR (Insights from Eugene Litvak at IHI) like that before.
on August 16, 2010, 6:12 pm Nike air max 90 said
Thanks a lot for enjoying this beauty article with me. I am apreciating it very much! Looking forward to another great article. Good luck to the author! all the best!
on August 16, 2010, 6:13 pm cell phone battery said
That\'s great, I never thought about Nostradamus in the OR (Insights from Eugene Litvak at IHI) like that before.
on August 16, 2010, 6:13 pm Ultrasound said
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!
on August 16, 2010, 6:14 pm Ultrasound said
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!
on August 16, 2010, 6:15 pm cell phone battery said
wow...this is something i have never ever read.very detailed analysis.
on August 16, 2010, 6:15 pm cell phone battery said
That\'s great, I never thought about Nostradamus in the OR (Insights from Eugene Litvak at IHI) like that before.
on August 16, 2010, 6:16 pm cell phone battery said
That\'s great, I never thought about Nostradamus in the OR (Insights from Eugene Litvak at IHI) like that before.
on August 16, 2010, 6:16 pm cell phone battery said
That\'s great, I never thought about Nostradamus in the OR (Insights from Eugene Litvak at IHI) like that before.
on August 16, 2010, 6:16 pm Cheap Jordan Shoes said
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming.
on August 16, 2010, 6:19 pm car dvd player said
This was a useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful.
on August 16, 2010, 6:19 pm car dvd player said
This was a useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful.
on August 16, 2010, 6:27 pm Cheap Nike Shoes said
Youngsun specializes in Carton Sealer, Smart Stainless Steel Carton Sealer ,Sealing Machine ect.Youngsun carton sealer saves time, saves money and improves efficiency which widely used in food electronics toiletry and manufacture industries. Thank you!
on August 16, 2010, 6:32 pm air max 90 said
I found this web-site by on a fluke when I was exploring on Google then I arrived onto your site. I\'ve to speakyour world-wide-web webpage is pretty cool I honestly loveyour theme!
on August 17, 2010, 6:41 pm ping rapture v2 driver said
Nice website. Very cool content. Thank you!!!
on August 17, 2010, 6:42 pm gucci bags said
Thanks for this great post it was very informative and helped me with my own project I am attempting to complete.
on August 17, 2010, 6:44 pm giuseppe zanotti said
Good website and happy messages. I like it. Thank you master!
on August 17, 2010, 6:46 pm car dvd player said
So informative site! Big thanks!\nThanks for a great time visiting your site. It\'s really a pleasure knowing a site like this packed with great information.
on August 18, 2010, 10:51 am lingda said
Hello, welcome to our wedding dress factory. It’s a fantastic world where can make you be a beautiful bride. The \r\nfactory is on a large scale, and has developed many transactions, includes \r\nwedding dresseswedding dresswedding gownswedding gownwholesale wedding dresses\r\nwedding dresses customwedding dresses factoryetc. Look forward to returning a visit.
on August 20, 2010, 5:11 pm air max 360 said
his site is amazing. Very well developed with great information.\nThanks for a wonderful experience.
on August 20, 2010, 5:35 pm ping g15 irons said
Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.
on August 20, 2010, 5:37 pm air max 90 said
Great post and now I know what to do, thank you! Actually this Blog post helped me a lot. I hope you continue writing about this kind of entry.
on August 20, 2010, 5:40 pm gps navigator said
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I\'ll be subscribing to your feed and I hope you post again soon
on August 20, 2010, 5:44 pm christian shoes said
Your website is great. When is the next post comming on this topic.I\'m happy I found this blog, hope you can come to exchange my website I am a novice!
on August 20, 2010, 5:45 pm christian shoes said
Your website is great. When is the next post comming on this topic.I\'m happy I found this blog, hope you can come to exchange my website I am a novice!
on August 24, 2010, 6:06 pm Cheap Ed Hardy said
Keep on sharing for more information hunt here.
on August 26, 2010, 6:13 pm TIFFANY said
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming.
on August 27, 2010, 7:26 pm Essay Writing UK said
The codes are great and plus the functionality that was stated is well defined. Thank you for the informative explanation in here.
on August 28, 2010, 12:12 pm cheap replica handbags said
The codes are great and plus the functionality that was stated is well defined. Thank you for the informative explanation in here
on August 30, 2010, 4:33 pm sleeper sofa mattress said
This sounds good. I would like to use it.
on August 30, 2010, 4:33 pm sleeper sofa mattress said
This sounds good. I would like to use it.
on August 31, 2010, 3:25 am liability insurance ny said
This sounds good. I would like to use it.
on August 31, 2010, 5:42 pm air jordan said
Check back soon for updates!
on August 31, 2010, 5:42 pm air jordan said
Check back soon for updates!
on August 31, 2010, 5:44 pm mbt sport said
I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post
on August 31, 2010, 5:45 pm puma shoes said
I just want to say I like it and thanks.
on September 1, 2010, 2:18 pm rolex said
fake rolex watches for sale this [url=http://www.kikwatches.com]replica[/url] possible fake watches
on September 1, 2010, 2:22 pm rolex said
ewrer
on September 1, 2010, 6:39 pm dunk premium said
There will be efforts at communication abroad, canvassing and organization of international commercial missions. This should all begin in the coming months.
your thoughts