Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Flash General Questions > Flash 9 General Questions

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-18-2007, 07:24 PM   #1
matt@macguffinandshemp.co
Registered User
 
Join Date: Jun 2007
Posts: 3
Default Omit trace actions [via code?]

Hi I was wondering if there was a bit of code that had the same effect as pressing the 'omit trace action' button in the publish menu.

What I'm looking to do is allow trace actions when the swf is published on one domain (used for testing) but omit them when it goes to the live server.
As I don't want to recompile after testing I was hoping someone knew of a trace on/off command that can be added to the AS.

Cheers
Matt
matt@macguffinandshemp.co is offline   Reply With Quote
Old 06-18-2007, 07:54 PM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
Default

Howdy and Welcome...

The output from the trace() function is visible only within the Flash IDE... and there is no ActionScript that you can use to turn on/off the output...
Maybe I am missing what you are asking???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 06-18-2007, 08:03 PM   #3
matt@macguffinandshemp.co
Registered User
 
Join Date: Jun 2007
Posts: 3
Default

Using flash player 9 debug you can see all the trace actions from any flash movie that's on the web. I want to see these on my test domain but don't want them visible to the general public when the swf goes live.

Cheers
Matt
matt@macguffinandshemp.co is offline   Reply With Quote
Old 06-18-2007, 08:30 PM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
Default

Well... That's out of my league cuz I have not tried CS yet... Let me move the question to the right forum for you...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 06-18-2007, 09:54 PM   #5
dr_zeus
Flash Adventurer
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,975
Default

There is no way to do this via ActionScript. You must recompile your SWF.
__________________
Josh Tynjala | JOSHBLOG | Bowler Hat Games
dr_zeus is offline   Reply With Quote
Old 06-19-2007, 07:20 PM   #6
kdittyr
Senior Member
 
Join Date: Jan 2006
Posts: 104
Default

I always put a testing variable in my code, then an if statement that says if testing == 1 allow trace calls... This has to be done for every trace call in your code. I am sure there is a better work around, but it works very well for me. I have been doing this ever since I saw a plugin for firefox that could supposedly read the trace calls, though I don't remember what it was called. That could potentially be a huge security risk for many websites that I work on, this is my fix.

Once again:
ActionScript Code:
// testing variable for trace allowance // if this is for release change to 0 var testing:Number = 1; // code // code // code // code // then wherever a trace call might be if(testing == 1){     trace("whatever it is I am tracing"); }

Last edited by kdittyr; 06-19-2007 at 07:24 PM..
kdittyr is offline   Reply With Quote
Old 06-19-2007, 07:56 PM   #7
dr_zeus
Flash Adventurer
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,975
Default

Quote:
Originally Posted by kdittyr View Post
I have been doing this ever since I saw a plugin for firefox that could supposedly read the trace calls, though I don't remember what it was called. That could potentially be a huge security risk for many websites that I work on, this is my fix.
You're thinking of FlashTracer.
__________________
Josh Tynjala | JOSHBLOG | Bowler Hat Games
dr_zeus is offline   Reply With Quote
Old 06-19-2007, 08:39 PM   #8
kdittyr
Senior Member
 
Join Date: Jan 2006
Posts: 104
Default

That's the one, thanks
kdittyr is offline   Reply With Quote
Old 06-19-2007, 11:00 PM   #9
plutocrat
AVM2 has mood swings. :(
 
Join Date: May 2007
Posts: 226
Default

To be honest, I think you are going about this the wrong way.

I use a Console class that lets me add, trace, store and manipulate my development output. Here is a small chunk of it that is pertinent here:

ActionScript Code:
//Class: package com.utils {         flash.utils.getTimer()         public class Cnsl {                 public static var aCnsl:Array = new Array()         public static var isTracing:Boolean = true;                     public static function t($:*):void {                         aCnsl.push(getTimer()+" > "+$)             if (isTracing) trace(aCnsl[aCnsl.length-1])                     }     } } //Implementation: import com.utils.Cnsl Cnsl.t("IN UR CONSOLE, TRACIN UR STUFF") /* Output @ 4 secs into the program: 4000 > IN UR CONSOLE, TRACIN UR STUFF */

Note that as the traces are stored in an array, they can be used again, or traced "internally" using an in-application TextField. Further, Cnsl.t() can be accessed by the user if need be, thereby allowing for console input mid application.

Why the vry shrthnd? I use the class a lot, and so it is lame to have to write Console.addTracedVariableValueInHere(), rather than Cnsl.t()

Finally, you will note that if I want to turn off tracing, I can simply by calling Csnl.isTracing = false. Easy easy.

Hope that helps.

Last edited by plutocrat; 06-19-2007 at 11:05 PM..
plutocrat is offline   Reply With Quote
Old 06-20-2007, 11:46 PM   #10
matt@macguffinandshemp.co
Registered User
 
Join Date: Jun 2007
Posts: 3
Default

I ended up adapting the bit-101 debug class to simply trace rather than send the messages to his console

http://www.bit-101.com/blog/?p=642

I now have a neat little class called 'de' so to trace I just type de.bug('arg') and I get arg= arg (saves on a bit of typing)

I've hooked this in to a _global variable that looks for certain key words, such as 'offline' or the test server domain. So I now can trace in my test environments and it shuts down when live.

Thanks for everyone's suggestions
matt@macguffinandshemp.co is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A specific map zoom out boundary Q DoubleE ActionScript 1.0 (and below) 2 01-17-2007 01:53 PM
Capturing trace() actions into a variable mikiti ActionScript 2.0 0 01-25-2006 04:42 PM
Round Class (ActionScript 2.0) Madokan ActionScript 2.0 4 09-02-2005 11:57 AM
Don't do this - Code in Trace Actions AdamSchroeder ActionScript 2.0 1 01-20-2005 04:16 PM
omit trace actions by as buggedcom ActionScript 1.0 (and below) 1 06-16-2003 02:27 PM


All times are GMT. The time now is 06:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.