December 29, 2008JavaScript Errors: Testing for the existence of functions in JavaScript

When using multiple JavaScript libraries, it is inevitable that one JavaScript file will need to call functions named in other libraries. This is necessary but can cause issues if all of the libraries aren't present.

Error handling with JavaScript is somewhat lackluster. With this in mind, you should do your best to catch and handle errors and avoid sending them to the end-user. In order to prevent errors and allow for scalability, you should test for functions that aren't present in the script where you are calling them.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 01:38 PM. Filed under: JavaScript • (0) CommentsPermalink
December 10, 2008All comments on the Code Blog now require moderator approval

Unfortunately, the griefers of The Internet, comment spammers, have made it necessary to take the precaution of requiring all comments made on this site to be moderated. This means that any comments posts you see will not be imeadiately visible until moderator approves it. I apologize for the inconvenience, but the spam just isnt good for anyone, and this is the only way I can keep up with it.

On a side note: I realize I haven't posted in a while, but a lot of things have been happening in my home life recently. However, I do have some posts in the pipeline, so subscribe to the RSS feed and keep checking back. Thanks to all the readers for your support.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 05:46 PM. Filed under: News • (0) CommentsPermalink
August 25, 2008Making Anonymous Functions and Closures Work in ActionScript 2.0

One of the most powerful idioms available in JavaScript is the anonymous function closure: e.g. (function(){})();. If you are unfamiliar with this, it simply creates an anonymous scope bubble that can be used to prevent automatic global variables, or trick JavaScript into allowing private variables. Unfortunately, this idiom isnt available in ActionScript 2.0. It simply doesnt work. (As of ActionScript 3.0, it works perfectly.)

This means that, on the surface, the only way to prevent time line variables from being constantly created is an init function of sorts. (ActionScript 2.0 has a pseudo global object which is the main time line of a movie level, and a totally global object named _global.) This also means that private variables are restricted to the creation of object classes. I personally get annoyed at times with classes in ActionScript. One of the things that has always bugged me with ActionScript 2.0 and the introduction of classes is that they are hard to make portable. (I work on no less than 3 computers in a single week, and 4-5 when on business trips, so portability is paramount to my work.) Rather than being able to simply include the classes in the same folder as the flash working file (*.fla), you must specify where on the computer the includes are. This is just annoying if you work on the file on several different computers. There are a couple of ways to avoid naming the class include folder on each computer, but they are as much of a pain as the default method. Fortunately, there is a solution.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 09:35 PM. Filed under: Flash-ActionScript • (0) CommentsPermalink
January 09, 2008Parsing a nested or name spaced object from a string in ECMAScript

Often times when I am making dynamic scripts in Flash or JavaScript, I want to call an object method using a string. It may be a situation where I am stuck using fscommand (due to a customer request of a Flash version <8) or just writing script with script.

The function is executed somewhat simply by splitting the string at the dots and adding them as subscripts to one another in order. However, there are some other pieces to it that make it a little more friendly to mistakes and general usage.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 09:37 PM. Filed under: JavaScript • (0) CommentsPermalink
August 22, 2007Create Right Click Menus to Test AIR Files (Win/Mac)

At the beginning of this year, when I first heard about A.I.R. I was excited to learn more about it and see what I could do with it. What really jumpstarted my interest was a trip to Cincinnati, OH to the Adobe onAIR Bus Tour. At this point I am full steam excited about working with AIR.

I work on a Windows machine at work and Mac at home, so I am also excited to see cross platform development. One thing that is a little wonky about AIR is the way that you test your applications. Since AIR is built with an SDK instead of a builder application, such as Flash, you have you use the terminal to launch the SDK. So I came up with methods for OS X and Windows XP to use right-click contextual menus to test AIR applications. I will first note that you can use Aptana, Flex 3, Flash CS3, and Dreamweaver CS3 to test your AIR apps, but i thought i would make something for the hardcore coders. Though, I personally use all the aforementioned for AIR.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 01:18 AM. Filed under: AIR • (1) CommentsPermalink
June 19, 2007Expression engine 1.6 Preview and Rick Ellis Birthday Contest

So Expression Engine is previewing version 1.6 (filled with LOADS of new features) and it is also EE CEO Rick Ellis' Birthday. To celebrate this and some new software, they are having a photoshop contest that ends noon Tuesday June 19th, 2007. Check out the forums here for the other submissions. Here is the original blog post.

Without further adieu here are my entries.

Read Full Article...

AddThis Social Bookmark Button Posted by Greg Ferrell at 12:14 AM. Filed under: ExpressionEngine • (4) CommentsPermalink

Page 1 of 3 pages  1 2 3 >