Month: April 2004

PHP Alternating Color Table Rows for Drupal or Dreamweaver sites

This is based on the great tutorial by phpfreak at phpfreaks.com For a more complete explanation of this, take a look at his article.

The main variation I have made here is to adapt it for the drupal database and to separate the HTML more from the PHP to make it easier for designers to alter without needing to escape the code characters: a big source of errors for those of us who are not writing code day in and day out.

This will also work well dropped into a Dreamweaver-created php site – just change “nid” and “title” to whatever fields you want to display instead, and use the query dreamweaver generates when you define a recordset.

If you are new at this, it may go more smoothly if you first create a dynamic site in Dreamweaver, then create a dynamic table with whatever fields you want, THEN add in the additional code to generate the colors by comparing that file and this.

Continue reading

Getting cubic bezier drawing API’s to work in my projects

There are several examples of drawing methods that draw a cubic bezier line that can be changed interactively by moving two control points and two anchor points, which is exactly what I needed for a project. An example of one is HERE. This one is by Robert Penner, from his book: Robert Penner’s Programming Macromedia Flash MX”

I couldn’t figure out why I could not get these functions to work in my own pieces, even when I exactly duplicated the structure of his flash movie. They would work in his, but not in mine.

The first frame of the movie has two “include” references in it, to two actionscript files containing all the common functions for his drawing methods.


#include "drawing_api_core_extensions.as"
#include "bezier_draw_cubic.as"

Continue reading

Upgrade your Subcategories Plugin

A few days ago, I deleted 2 MovableType categories that did not have any entries in them. The next time I tried to publish an entry, I got this error:


Can't call method "label" without a package or object reference at plugins/sub_cats.pl line 67

It turns out that the Subcategories plugin could not deal with non-continuous numbering of category id’s. Deleting the two categories caused gaps at #3, and #11.

I did a quick search and came up with this page:
Comments on SubCategories version 0.2.1

Continue reading

Accessing the main timeline from a loaded SWF on another level.

I have a flash file which loads an external SWF (call it external.swf) into the main timeline, on level 10. In this case, using _root or _parent to call the symbols on the main timeline will not work, since _root or _parent would refer to items on _level10.

The main timeline also contains a movie clip called “swapColors_mc” with two frames called “red” and green”.

To control the color change of swapColors_mc by clicking a button in external.swf once it is loaded, open “external.fla” (the original flash file from which external.swf is created) and add this actionscrip to the button:


on (release) {
_level0.swapColors_mc.gotoAndPlay("green");
}

Continue reading