FlashComGuru Home InfluxisCDNImediaseeUvault
                                                                                       Forum Index | Active Topics | Register
                                                                                                          List Overview | List Archives
                                                                                                                           About this site | Advertise
 

home

Adobe AIR (11)
Applications (40)
Books & Training (11)
Collaboration (18)
Components (10)
Events (80)
Flash Player (35)
Flex (39)
FMS (110)
General (123)
Hosting (6)
Jobs (17)
Off topic (36)
OSMF (3)
Press Releases (23)
Site Check (11)
Tools (53)
Videos & Players (74)

Follow me on Twitter

 
Here's one of the category "how come I didn't know this?". At least that was the case for, I guess I have been living under a stone.
Consider this code snippet in AS3:
var i:int = 123;
var foo:String = "foo";
var wtf:Object = {prop:"rad"};

trace(i, foo, wtf);
What happens when you compile this and watch the Output window or Console? I thought it'd fall over, but in fact you get
123 foo [object Object]

Neat, I know. But I haven't known for long (it took Tink's code for me to notice).

Comments
[Add Comment]
Nice tip...

Reminds me of when I used Flash 5 for two years before discovering the animation easing feature.
# Posted By Joe Hakooz | 2/5/09 10:55 PM
I used this once back in the day, but I completely forgot it was possible. Thanks for the reminder, i'm already using it in projects again.
# Posted By Dustin Sparks | 2/5/09 11:32 PM
I didn't know that either :-|

I always wrap them as an array:
trace([i,foo,wtf]);
# Posted By Randy Troppmann | 2/7/09 6:35 PM
I always need stuff to be more verbose since at any given time I can have up to 20 traces going. I just concatenate them since they're going to be converted to strings anyway. trace("i: " + i + " foo: " + foo)
# Posted By Brad | 2/9/09 4:49 PM
Bugger, I've been leaving traces statements in my code ;)
# Posted By Tink | 2/10/09 2:22 PM
hmm.. simple but logic :)

Didn't knew that either..
# Posted By Tiago | 2/13/09 1:37 PM
Stefan if u use getQualifiedClassName inside a class u can get a package of that class.

like this:

package com.mysite.appname
{
   import flash.utils.getQualifiedClassName;
   
   public class TestTrace
   {
      public function TestTrace()
      {
         var i:int = 123;
         var foo:String = "foo";
         var wtf:Object = {prop:"rad"};
                  
         trace( getQualifiedClassName( this ), i, foo, wtf );
         // com.mysite.appname::TestTrace 123 foo [object Object]
      }   
   }
}

var example:TestTrace = new TestTrace();
# Posted By mauricio massaia | 2/19/09 12:59 PM