E4X: Test If Attribute Exists

Actionscript, Flash

Quick Tip:

When using E4X (AS3) to test whether an attribute exists, if you write:

?View Code ACTIONSCRIPT
var nX:Number = (shape@nY) ? shape@nY : 0;

an exception will be thrown. You should instead write:

?View Code ACTIONSCRIPT
var nX:Number = (shape.attribute('nY').toString()) ? shape@nY : 0;

I had hoped that Flash/Flex/AS3 had an hasAttribute method, but I guess this will do.

Share

File Comparison on OS X

mac

I recently ran into a version control problem with git. Well, it wasn’t actually a git problem, but rather a version control management problem. One of the projects that I have been working on has multiple developers working various aspects of a web application. The client recently told me that during a recent merge, git could not handle the number of changes. The reason was that many developers were making changes to the same file(s) (relevant to the scope of their project) and the client waited too long to try to merge.

So I was given the latest file(s) and I had to manually merge my project. I was dumbfounded. I had created JQuery plugins for the project and these were not difficult to insert into the file(s). But I also made a lot of UI changes to the main file and made numerous changes/additions to the CSS file.

After eyeballing each line of code of two files for about 1/2 hour, I realized that there must be a better way. So I googled: ‘File Comparison OS X’ and was surprised to find that I already had a utility installed (FileMerge.app). Apparently, the utility was bundled with XCode. Who Knew?

So I opened the FileMerge app (Macintosh HD/Developer/Applications/FileMerge.app), selected the two files and began to compare the differences. I didn’t want to merge the two files because I did not know how the changes would affect another developer’s code. It took me a while to manually make the changes to the master file(s), but at least I did not have to try to find where the differences were.

Share

Flash AS3: Classpath of Package

Actionscript, Flash

I just received a Flash/AS3 error message:

1172: Definition could not be found

After many years of developing websites using Flash/AS2, I abandoned Flash web development for the new world of Ajax development (actually, Flash was the first Ajax/Web 2.0 framework).

I recently began to convert some of my AS2 class packages to AS3. I upgraded to Flash CS3 a couple of years ago, but because I have recently been doing a lot of Ajax development (primarily JQuery, YUI, and Dojo), I have only done minor Flash development, limited to Flash banners and other animation projects.

After a lot of frustration, I figured out why I was receiving errors when converting my flash AS2 classes to AS3 packages.

Continue reading

Share

Drupal Install: Configuring Apache

Drupal

I plan to create Drupal video tutorials in the near future. Although I use a Mac as my primary development box, I have Adobe Captivate installed on my Windows PC. So I installed Drupal on my PC and I ran into problems that required Apache configuration changes.

index of/

The Problem: When I clicked on the ‘Administer’ link on my site’s home page, ‘index of/‘ and a list of my site files and directories displayed instead of the administration page. In fact, any page that I attempted to go to resulted in this ‘index of/’ display.

The Solution: I opened the Apache configuration file (httpd.conf) and found that the Allowoverride for .htaccess files was set to None. I set Allowoverride to All and restarted Apache.

Clean URLs

The Problem: I always enable Clean URLs, but for some reason, I was unable to on my PC.

The Solution: I again opened my httpd.conf file and found that Apache’s mod_rewrite module was not enabled (this must be enabled in order to use Clean URLs). So I uncommented the line that loads the module and restarted Apache.

Now Drupal is running perfectly on my PC. I was a bit surprised that I had not configured Apache prior to this, but I guess that I use my Mac (and Ubuntu) so much that I never found the need. Enjoy.

Share