Topic: CUSTOMIZATION: Exposing values to your XML file

What I'm about to discuss here is pretty simple, but I'll take the time to post it in case somebody wants to do some very simple customization.

You'll need SV Pro 1.8 and Macromedia Flash (I use v8).

Let's say you wanted to specify the text color of your captions, and your title. Currently, both of those can be adjusted by editing your Options.as file and then republishing the viewer.swf file. But who wants to do all that just to change a text color?!

We have an external config file, after all. That's the point! I should be able to control color values all day long via my gallery.xml.

So, let's edit some ActionScript. We want to expose the settings for titleTextColor and captionTextColor and make them available to gallery.xml by doing the following:

1) Using Flash, open XMLManager.as for editing.

2) At line 66 or so, look for public function set xmlData(xmld:XML)
(This is the function that grabs the variables from your gallery.xml file and loads them into SV at runtime.)

3) Look for the line of script that reads like
captionTextColor = setIfValidNumber(xmlRoot.attributes.textColor,captionTextColor);

Should be about line 93. We are concerned with this line and the very next line, where we'll control the caption and title colors, respectively.

As you can see, both of these take their cues from textColor which can be set in your gallery.xml. But that does us little good if we want to specify caption and title colors independently.

4) I suggest changing line 93 to something like this:
captionTextColor = setIfValidNumber(xmlRoot.attributes.captionColor,captionTextColor);

Now, all we're doing is creating a unique variable for the caption text color, a variable we can tag in our gallery.xml just like any of the other variables there.

5) Change line 94. Insert titleColor in place of textColor.

6) Save your script and republish.

7) Edit gallery.xml by adding, as an example,
titleColor="0xffff00"
captionColor="0xffff66"

to the file. (Them there are zeros, not the letter Oh.)

The titleColor and captionColor references here correspond exactly to the edits you just made in the XMLManager.as script. Now you can control caption and title text colors independently. No need for a Flash editing environment.

I'd like to point out that simple customizations like this are well, quite simple... because of the clear and straightforward manner in which the ActionScripts are written by AirTight. It's always a pleasure to work with good, clean, concise code. Thanks, guys!