Flash news user manual

Table of contents

Introduction

Flash news application is a piece of software that web developers can place on their web sites to allow these to display latest news or announcments. The application has multiple configuration options, however it's Flash front end always uses news stored in XML format. The XML news data can be stored on the same server as the Flash front end or on a different server. Using included ColdFusion code one can create XML news files automatically.

News display is only one of possible uses. This program can also display announcements or be used as a form of banner advertising.

Please note that this documentation assumes that you have some basic understanding of how the internet and the web server works. For example, it is assumed that you know how to upload files to your web server or how to work with the directory structure.

Program features

Why Flash?

I developed this news application's front end with the use of Flash MX 2004. My decision to develop this application in the first place was prompted by the poor quality of available alternative news viewers. I saw multiple Java based viewers that in my opinion are too cumbersome to be used as a news applet. Java has many advantages but it is not perfect. It takes time to load the applet and it is rather big compared to less than 2kb for Flash. Also, the need to have Java virtual machine installed is a bit of an inconvenience. Flash player, in my opinion, is more widely accepted platform for interactive web content.

System requirements

Depending on the configuration of the Flash news application you will setup, your system needs to meet the following requirements:

Your end users will have to install (if they don't have it already installed on their PC) Flash player either version 6+ or 7+ depending on the package you chose to deploy.

For XML data files located on a different domain than the Flash front end you may run into some problems with build in security implemented by Flash player. For more information, please read security section.

List of command options

Command line options are name value pair attached to the SWF file in the template that is embedding the SWF file. For example, you may have something like this: "flashnews_full.swf?dataFileName=version7/flashnews.xml&delay=1000" Please note that in order for these options to take effect in both IE and Mozzila based browsers you need to add parameters to both locations where you see the file name. Please see examples for more information.

Available settings (all optional):

Variable NameDefault ValueAction Performed
dataFileName flashnews.xml The full path to XML based data file that contains news items.
delay 1000 The number of milliseconds before new news items is shown. This value is used if there is no optional value provided in the XML source.
backgrdImage [none] The full path to the background image that is to be shown behind news text, can be either jpg or swf format, to cover the whole background should be 550 by 60 pixels (for full versions) or 400 by 50 pixels (header only versions). This image is used if more specific background image is not provided in XML source. Please note that version 7 will load image 1st and then apply delay, version 6 is simpler and will load the image and process delay at the same time.
backgrdColor 0xFFFFFF Background color (invisible if image is chosen for the background).
frameColor 0x0066CC Background frame color (invisible if image is chosen for the background).
mainFS 16 Category description text size.
headFS 14 Headline text size.
regFS 10 News item description text size.
mainFC 0x000000 Category description text color.
headFC 0x000000 Headline text color.
regFC 0x000000 News item description text color.
slideDir n Direction in which text "slides". By default there is no sliding (n). Other options are t (slide from top) and b (slide from bottom). Only text can slide at this time. Any background image used will just show up.
slideSpd 2 Number of pixels to move per frame while sliding (Flash movie plays at 30 frames per second) higher value means higher speed of sliding. Since only text can "slide" this setting applies to text only.

Examples of application use

I would like to suggest three main intended uses for this application. This is just an idea as to how one use it. You may of course use it for whatever you want as long as you don't violate the license.

Installation

Deployment without ColdFusion

The installation is very simple if you are not going to use ColdFusion as the medium that automatically generates your news XML data files. All you have to do is copy the SWF file of your choice to the directory in which you will store news application. For example, copy "flashnews_full.swf" file to directory "C:\inetpub\wwwroot\your_web_site_name\Flash_news_app" (assuming you are using IIS server).

The XML data file that your Flash application will use to display news items can be located anywhere, however there are some security restrictions you need to be aware of (read security section). The location of XML data file is set using "dataFileName" parameter. By default, this parameter is "flashnews.xml".

The HTML code that is used to embed Flash movie inside of it is generated by Flash IDE. However, in case you don't have Flash you can use code provided here or copy code from one of the examples. Code provided here is the most simple one that Flash IDE generates. There are other, more complex, scripts which can, among other things, detect the version of Flash player installed on user's computer.

Please note that the control variables are placed beside the movie name in two places. This is due to the fact that Internet Explorer uses object tag while Netscape based browsers use embed tag. In order to display our customized application in both environments we need to include values in both places.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="60" id="flashnews" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="movie" value="flashnews.swf?dataFileName=version7/flashnews.xml&delay=1000" />
	<param name="quality" value="high" />
	<param name="bgcolor" value="#ffffff" />
	<embed src="version7/flashnews_full.swf?dataFileName=version7/flashnews.xml&delay=1000" quality="high" bgcolor="#ffffff" width="550" height="60" name="flashnews" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

XML data file that contains news items has the following schema:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.tomkitta.com" xmlns="http://www.tomkitta.com" 
elementFormDefault="qualified">

<!-- definition of simple types: -->
<xs:simpleType name="targetType">
  <xs:restriction base="xs:string">
	<xs:enumeration value="_blank"/>
	<xs:enumeration value="_top"/>
	<xs:enumeration value="_parent"/>
	<xs:enumeration value="_self"/>
  </xs:restriction>
</xs:simpleType>
<!-- definition of complex types: -->
<xs:complexType name="newsItemType">
	<xs:all>
		<xs:element name="source" type="xs:string" minOccurs="1" maxOccurs="1"/>
		<xs:element name="title" type="xs:string" minOccurs="1" maxOccurs="1"/>
		<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
		<xs:element name="link" type="xs:string" minOccurs="1" maxOccurs="1"/>
	</xs:all>
</xs:complexType>
<xs:complexType name="newsType">
	<xs:sequence>
		<xs:element name="newsItem" maxOccurs="unbounded" type="newsItemType"/>
	</xs:sequence>
	<xs:attribute ref="target" use="required"/>
	<xs:attribute ref="delay" use="optional"/>
	<xs:attribute ref="image" use="optional"/>
</xs:complexType>
<!-- definition of attributes: -->
<xs:attribute name="target" type="targetType"/>
<xs:attribute name="delay" type="xs:integer"/>
<xs:attribute name="image" type="xs:string"/>
<!-- root element definition: -->
<xs:element name="news" type="newsType"/>

</xs:schema>

Here is the DTD for the XML data file:

<!ELEMENT news (newsItem+)>
<!ELEMENT newsItem (source,title,description?,link)>
<!ELEMENT source (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT link (#PCDATA)>

<!ATTLIST newsItem target (_blank|_self|_parent|_top) #REQUIRED>
<!ATTLIST newsItem delay CDATA #IMPLIED>
<!ATTLIST newsItem image CDATA #IMPLIED>

XML Schema is ignored by Flash and is provided here (as well as in separate flashnews.xsd) for reference only. You may need schema to create your own XML news data using methods that you create. The DTD is also provided as a separate file (its also ignored by Flash), flashnews.dtd

Deployment with ColdFusion

The setup of the Flash front end and XML file is identical to the above deployment scenario. What is added here is the setup of ColdFusion templates and components. For ColdFusion to work on your server you need to have ColdFusion Server installed version MX (6) or higher.

The ColdFusion template called "createFile.cfm" contains the script that creates new XML news data file. This is the template that needs to be executed by your scheduled event to create XML news data file. You can use scheduler included in ColdFusion MX+ or some other software that will browse to the location that contains "createFile.cfm".

Inside of "createFile.cfm" there is a number of constants which you should be familiar with, outlined in the table underneath.

Constant nameDefault valuePurpose, value range
NEWSDATAFILENAMEPATH "flashnews.xml" Path and name to the XML news data file that is to be created. By default this file is created in the same directory in which the ColdFusion source code is installed. Default file name is "flashnews.xml". To change the path, for example create file named "mynews.xml" in parent directory (1 up) you would use "../mynews.xml" for path to the XML data file.
MAXNEWSITEMS 3 Maximum results per news feed - some news sites will have many news items, for example there may be 10 headline news items on ABCDE news site. This value specifies the maximum number you want to accept. By default its 3, so the first three news items from any particular news feed get recorded while all consecutive one's are ignored. If this value is specified as 0 then there is no limit.
CREATEDESCRIPTION true Flash can show description of a news item, however this is optional. To save on space used by the XML news data file "description" content can be omitted. However, if its left in the XML it will not "hurt" anything other than disk space and disk read access for larger file. By default we create the description XML node. Alternative value for this variable is "false" (without quotes).

The "createFile.cfm" template uses "getnews.cfc" ColdFusion component to create XML file. This component has in it one constant of interest, "CONFIGURATIONFILENAME" which is the name of XML configuration file. By default, the configuration file name is "news.xml". Under normal circumstances there is no reason to change this file name. The option to change this file name is provided to you because it is good programming practice to avoid magic constants in code.

You can schedule run of "createFile.cfm" using ColdFusion scheduler. To access the scheduler you can use ColdFusion administrator. If you are on a shared server and don't have access to the administrator, you can use <CFSCHEDULE> tag. For example, the following code will create (after single execution) scheduled event that will run every 30 minutes:

<cfset myURL = "http://www.your_web_site.com/news_location/createFile.cfm">
<cfschedule 
	action="UPDATE" 
	task="rssNewsRefresh" 
	operation="HTTPRequest" 
	url="#myURL#" 
	startdate="#now()#" 
	starttime="#timeFormat(now())#" 
	resolveurl="No" 
	publish="No" 
	interval="3600" 
	port="80">

The choice of the SWF file you choose to deploy on your server depends on your visual taste, on the audience you want to reach (Flash 7 vis Flash 6) and on location of your XML data file (read more about security in Flash).

The "news.xml" file is used to configure which news feeds are scanned in order to create news data file. Schema is provided here for reference.

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.tomkitta.com" xmlns="http://www.tomkitta.com" 
elementFormDefault="qualified">

<!-- definition of complex types: -->
<xs:complexType name="categoryType">
	<xs:sequence>
		 <xs:element name="rss" type="xs:string" maxOccurs="unbounded"/>
	</xs:sequence>
	<xs:attribute name="target" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="newsType">
	<xs:sequence>
		<xs:element name="category" maxOccurs="unbounded" type="categoryType"/>
	</xs:sequence>
</xs:complexType>

<!-- root element definition: -->
<xs:element name="news" type="newsType"/>

</xs:schema>

Installation examples

Without ColdFusion

Here is an example of how you would setup this application, step by step without the use of ColdFusion. I assume you are running Windows on your server, setup for other operating systems is very similar.

With ColdFusion

When using ColdFusion as XML news file generator, you need to go through additional setup steps:

Flash MX/MX 2004 Security

Flash MX and Flash MX 2004 have different security models that limit they way your Flash application can access data (XML news data). This security effect what you can do with remotely stored XML. There are no security restrictions for loading of XML files that are stored on the same server as the calling Flash file. There are also no restrictions when Flash SWF file is executed on a local system (not in a browser where it is loaded from some server). In almost all setups security restrictions don't inhibit execution of this application. However, just in case your SWF file is on server A and XML file is on another server, B, you should be aware of restrictions that are outlined in the following paragraph.

For data (not cross scripting, data is defined as for example XML file) transfer across domains a special XML file is needed on the domain that has data called crossdomain.xml. For specific format of this XML file please consult your Flash MX/MX 2004 manual (ActionScript documentation).

Contact Information

For more information about this product please visit developer web site at http://www.tomkitta.com All alternative contact information is found on the web site under 'contact' section. This is documentation version 1.1, last modified on Feb 16th, 2005.

Version Changes

In version 1.11 the following enchancments and bug fixes were introduced:

In version 1.1 the following enchancments and bug fixes were introduced: