6
This Fall Lookout mobile discovered that developers were writing some pretting interesting things to LogCat and the talked about their findings at DefCon.
While, as a dev, you should try to never put sensitive information in your logs, you can use this system to turn off logging in your releases.
At the beginning of each of my classes i write:
public class MyClass
{
// Debugging
private static final String TAG = "MyClass";
private static final boolean GLOBAL_DEBUG = DebugMode.MODE;
private static final boolean LOCAL_DEBUG = true;
private static final boolean D = ( GLOBAL_DEBUG && LOCAL_DEBUG );
Notice the DebugMode.MODE is a separate class, and it’s a pretty simple one:
public class DebugMode
{
public static final boolean MODE = true;
}
Anyways, then, when I want to put something in LogCat I write
if (D) Log.d ( TAG, "something interesting happened");
Finally, when I’m ready to release, I only have to change the DebugMode class to:
public class DebugMode
{
public static final boolean MODE = false;
}
And voila! We now have both fine-grained, per-class control of how much info gets sent to LogCat, as well as a Global on/off switch that will help keep prying eyes out of our logs.
Anyways, hope that helps
filed under: Android, Interesting stuff, Scripts, Security | comments (0) | read more...
8
Going to keep this short for now but I wanted to upload some example files for the EventManager to help anyone having trouble understanding it or getting it working. I’ll post more soon about any specific questions people have but for now I’ve got to run and earn my rent money. Read the rest of this entry »
filed under: ActionScript, Misc, Scripts, Tutorials | comments (3) | read more...
15
Sometimes speed is essential. So recently for one of my projects that called Math.sin and Math.cos 1000 each every frame, I decided to create a lookup table. Now that I’ve finally had some time too, I got a chance to test what I though was a clear speed difference and I found some very surprising results.
filed under: ActionScript, Interesting stuff, Math, Misc, Scripts | comments (2) | read more...
9
Write an XMLLoader, wait for an event. Parse the xml, wait for some event. Start up some animations, wait for an event. Show some images. wait for an event. Sounds pretty tedious doesn’t it? Well if you’ve ever gotten tired of sequencing things here’s a simple class for you.
filed under: ActionScript, Misc, Scripts | comments (4) | read more...
9
Ever find that you have about 4350823498 different MovieClips in your library that you would like to ‘attach’ ? Yeah yeah it’s not attach in AS3 but you know what I mean! Anyways this was inspired by a code snippet I first read on Blitz Agency’s blog but have seen in many shapes and form since. So here’s my version of using getDefinitionByName with string constants to help centralize things.
filed under: ActionScript, Scripts | comments (0) | read more...
9
Nothing special here but if you want to have a look at one way of making an Array a specific type have a look at my take on it if you like.
filed under: ActionScript, Scripts | comments (0) | read more...
9
I’ve been experimenting with creating a sort of queue pool of commands that could be executed at any specified interval. But rather than creating a glorified tween sequencer, I wanted to have it be more generic and be able to “save” the previous state. The way I did this is via the often blogged about deep object copying using serialization. Unfortunately, it’s not possible to deep object copy a sprite or MovieClip directly so instead I added a type or proxying as well.
This is really the 0.1 verision of the class with quite a few bug fixes probably needed down the road but it shows some of the over-all concepts.
filed under: ActionScript, Scripts | comments (0) | read more...
25
Some say the days of callbacks are still going strong. Others say events just rock. Which is it? Heck, I’m not here to start a code-religion war so I’m not even going to begin to try and answer that one. Still, with all these fancy-pantsy, new-fangled events we have some big new challenges (and new opportunities too). Luckily, we’ve had some good guides in the past. Jason Cook’s great article Centralized Event Management in ActionScript 2.0 was a truly inspiring jump-off point, but now it’s time to jump a little farther and use some AS 3 in the process.
filed under: ActionScript, Scripts, Tutorials | comments (11) | read more...
