July 8th, 2009
Here are some command line tidbits that i use regularly and find to be very handy, hopefully you will too.
Create a list of files in a directory and all its subdirectories
find [path] -type f > [output file]
example for listing all files in the directory source:
find source -type f > files.txt
Monitor cpu usage
top -F -ocpu -s 5 -n 5
Update Modification Date Recursively
find {dir} -exec touch {} \;
backup a directory
rsync -av –delete [src] [dest]
Remove all hidden files begining with “.”
starts with current directory and recursively searches down
find ./ -name “* .[!.] .??*” | xargs rm -Rf
Posted in Code Example, Linux | No Comments »
June 18th, 2009
Working with ActionScript projects can offer some rather interesting challenges with some of the most basic parts of Flash development. Things like preloading your application and using linked MovieClips from a library, not to mention using embedded fonts in your TextFields. This really becomes interesting when you want to use more than one font in a single TextField. And sure you can embed font files right into the AS class, but that doesn’t always work. I’ve had numerous issues with OTF fonts.
The method that I have had the best success with is using the same technique as embedding symbols from Flash AS2 swfs. Here’s a step-by-step on how to do this.
Read the rest of this entry »
Posted in AS3, Code Example, Flash/Flex | No Comments »
May 21st, 2009
For some reason all of the code examples for using FMS are in AS2. Converting the examples to AS3 can be a bit challenging, especially since there is one really key piece of information that is left out that is new to AS3 and specific to the use of FMS2. The problem is the that FMS2 only supports AMF0, but in AS3 the default setting for the NetConnection class’ defaultObjectEncoding property is AMF3. Without changing this setting to AMF0, your code will seem to be correct, but will fail to connect without really telling you why. Check out the class that I created from the Adobe example and the MXML to use it.
Read the rest of this entry »
Posted in AS3, Code Example, Flash/Flex | 1 Comment »
May 9th, 2009
Even though AS3 has been out for some time now, there are still situations when you will need to load an AS2 compiled SWF into an AS3 compiled SWF and communicate with it. What if you could simply dispatch an event and listen for it on the other side? That’s what sugarcookie’s ASBridge does. Let’s see how it all works.
Read the rest of this entry »
Posted in AS2, AS3, Code Example | No Comments »
April 29th, 2009
Having a local web server to test your web sites and applications is essential to your development environment. It is very easy to set-up numerous virtual hosts for each of your projects, which allows you to develop your interactive masterpieces in a close to real world implementation. There are actually many aspects of Flash development that will exhibit different behavior or not even work at all if not served from a valid domain and by golly localhost counts. We’ll cover setting this up on Mac OS X 10.4, with additional notes on the differences with 10.5 at the end.
Read the rest of this entry »
Posted in Mac OS X | No Comments »
April 17th, 2009
While working on an application that has some drag and drop functionality, I noticed something very interesting about the dropTarget property of the Sprite class. It seems that the dropTarget returns the DisplayObject that is at the bottom of the display list which may not yield the result you are expecting. I added a MouseEvent.MOUSE_MOVE event listener to the Sprite being dragged and traced out the dropTarget to see what kind of result I would get.
Read the rest of this entry »
Posted in AS3, Code Example | 1 Comment »
March 11th, 2009
If you’re a Flash developer then you probably use trace() as an essential part of your development routine. Maybe you even wrote a custom logger application to get a peak into what’s happening with your Flash application. Point is that you like to see what’s going on behind the scenes.
Now you’ve moved on to the big leagues and started connecting Flash to PHP to add server-side functionality to your application, but how do you see what’s happening with your PHP code? PHP has a little know feature called error_log() that lets you output messages to your web server’s log file. By tailing your log files while running your application you essentially get trace statements from your PHP code! You can do this by opening your terminal if on a Mac or use something like cygwin on Windows, change directories to where the log files are and run the tail command with the follow flag.
Welcome to Darwin!
colossus:~ chris$ cd /var/log/httpd/
colossus:/var/log/httpd chris$ tail -f error_log
[Tue Jun 5 22:31:11 2007] [error] This is my trace statement from PHP!
Enjoy and happy PHP testing!
Posted in Code Example, PHP | No Comments »
March 3rd, 2009
I figured since I’m on the subject I would go ahead and create a custom logging target for sugarcookie and a companion logging app – LumberJack. This particular target sends log message objects over a LocalConnection to a basic logging console that will output them into a text field. Being able to see trace statements from a site running on any server, on any network can really help when debugging your application that is deployed somewhere besides your localhost. There are other tools out there that do this like RED|Bug, Xray or even FlashTracer, but this one is extremely simple and includes all the code so you can modify it to suit your needs.
First let’s create the new log target class by extending the existing mx.logging.targets.LineFormattedTarget Flex class. Then override the logEvent method with the functionality desired and you’re in business. Here’s how I did it:
Read the rest of this entry »
Posted in AS3, Code Example, Flex, sugarcookie | No Comments »
February 26th, 2009
Removing trace() from your code is a great way to optimize it and improve overall performance. This is easy enough to do in Flash by checking “Omit trace actions” in the Publish Settings window, but in Flex there is no such setting or compiler argument that I’ve seen. No worries, there is a solution.
Read the rest of this entry »
Posted in AS3, Code Example, Flex | No Comments »
February 11th, 2009
Recently I had the need to back up my svn repositories root directory that lives on our Linux dev server to a Windows server. At first I tried to mount an NFS Windows share to my Linux box, but because we don’t have an NIS server I am not able to authenticate my Linux account against my Windows account. Most of you developers out there that have to support yourselves will probably have this issue because most office IT infrastructures are Windows based which don’t always play nice with your Linux dev box. The answer to this wasn’t as straight forward as you might think, so I thought that I would share my solution.
Read the rest of this entry »
Posted in Code Example, Linux | No Comments »