Flash/Actionscript Programming

From late 2005 to early 2007, I developed a few nifty Flash applications. I am offering them free to use for most any purpose. Most of these are Actionscript 2.0 and XML. A few of them have either PHP or Coldfusion pages to help with minor tasks. Some are kind of glitchy in the Actionscript 3.0 world, but the ideas are still interesting. If you use them drop me a line and include the url where they are deployed and I'll come and check it out. If you make improvements send them to me and I'll update the files. If you have any questions I'll try to help you out.

The Ticker

I made this because I could only find javascript tickers but at the time I preferred Flash. It worked okay for what I used it for and it could be extended in may ways. One nice thing about it is that each of the scrolling items becomes a link.

counter=0;
i=0;
function addItem(){
_root.createEmptyMovieClip(“subcaption”, 3001);
_root[“subcaption”].createTextField(“subcaption_txt”, 1, 1, 1, 480, 25);
subcaption_fmt = new TextFormat();
subcaption_fmt.font = “scifiedbitmap”;
subcaption_fmt.size = 14;
subcaption_fmt.color = 0×3488C0;
_root[“subcaption”].subcaption_txt.text = ” “ticker_txt[i]” ”;
_root[“subcaption”].subcaption_txt.embedFonts = true;
_root[“subcaption”].subcaption_txt.setTextFormat(subcaption_fmt);
_root[“subcaption”].subcaption_txt.border = false;
_root[“subcaption”].subcaption_txt.multiline = false;
hscrollmonitor=new Array;
function removefirstletter(){
hscrollmonitor.splice(0,1, _root[“subcaption”].subcaption_txt.hscroll);
//trace(“hscrollmonitor ” +hscrollmonitor);
_root[“subcaption”].subcaption_txt.hscroll += 200;
//trace(“hscroll ” +_root[“subcaption”].subcaption_txt.hscroll);
if(_root[“subcaption”].subcaption_txt.hscroll==hscrollmonitor0){i++; if(i>=counter){i=0;}; addItem();};
//_root[“subcaption”].subcaption_txt.replaceText(0,1,”“);
//if(_root[“subcaption”].subcaption_txt.length==0){i++; if(i>=counter){i=0;}; addCaption();};
};
clearInterval(removefirst);
removefirst=setInterval(removefirstletter,140);
_root[“subcaption”]._x=5;
_root[“subcaption”]._y=8;
_root[“subcaption”].onRelease = function(){
getURL(link_array[i]);
};
};
var dataXML:XML = new XML;
dataXML.load(“ticker.xml”);
dataXML.ignoreWhite = true;
ticker_txt = new Array();
link_array=new Array();
gallery_main_array = new Array();
dataXML.onLoad = function(){
for (var i = 0; i var thisNode:XMLNode = dataXML.firstChild.childNodes[i];
if (thisNode.nodeName==”scroll_txt”){
//trace(“(“thisNode.nodeName“):”+thisNode.attributes.image);
//images_array[i]=thisNode.attributes.image;
ticker_txt.push(thisNode.attributes.info);
link_array.push(thisNode.attributes.link);
counter++;
};
};
//trace(“LIST = “+ticker_txt);
addItem();
};
//written by Steven Southard 11/19/2006

Image Slider

This could have many uses. It is a simple slider but it seems to have a nice pace. Add as many images to the xml file as you like.

i=0;
movieclips_array = new Array;
photo=0;
counter=0;
mousemonitor=new Array;
mousemonitor.splice(0,1, _xmouse);
_root.createEmptyMovieClip("slide",1);
function loadPhoto() {
function createnewmovieclip() {
i++;
clearInterval(changePhoto);
_root["slide"].createEmptyMovieClip("photograph"+i, i);
_root["slide"]["photograph"+i].loadMovie(currentarray[photo], "photograph"+i, i);
_root["slide"]["photograph"+i]._alpha = 100;
_root["slide"]["photograph"+i]._x = i*483-483;
_root["slide"]["photograph"+i]._y = 0;
movieclips_array.push(_root["slide"]["photograph"+i]);
clearInterval(setFade);
setFade=setInterval(fadeImage,1);
fadeImage();
};
function fadeImage() {
//_root["slide"]["photograph"+i]._alpha+=10;
//if(_root["slide"]["photograph"+i]._alpha >= 100){
clearInterval(setFade);
if(i if(i>=images_array.length){slide();};
//};
};
function wait() {
counter=0;
};

function slide() {
setwait=setInterval(wait,5000);
clearInterval(movementrate);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
movementrate=setInterval(sliderate,1);
};

function sliderate(){
//difference=_root.center._x-_root._xmouse;
_root["slide"]._x+=-2;
counter+=2;
if(counter>=483){
//difference=_root.center._x-_root._xmouse;
_root["slide"]._x+=2;
};
if(_root["slide"]._x<-(i-2)*482){movieclips_array[0]._x=i*482; movieclips_array.push(movieclips_array.shift()); i++;};
if(_root["slide"]._x>-(i-movieclips_array.length+2)*482){movieclips_array[movieclips_array.length-1]._x=(i-movieclips_array.length)*482-482; movieclips_array.unshift(movieclips_array.pop()); i--;};
if(_xmouse != mousemonitor[0]){
};
};
function slide2() {
_root.onEnterFrame=function(){
//_root["slide"]._x++;
difference=_root.center._x-_root._xmouse;
_root["slide"]._x+=difference*.02;
if(_root["slide"]._x<-(i-4)*483){movieclips_array[0]._x=i*483; movieclips_array.push(movieclips_array.shift()); i++;};
if(_root["slide"]._x>-(i-movieclips_array.length+4)*483){movieclips_array[movieclips_array.length-1]._x=(i-movieclips_array.length)*483-483; movieclips_array.unshift(movieclips_array.pop()); i--;};
};
};
/* for masking */
/*this.onEnterFrame = function() {
infoLoaded = _root["photograph"].getBytesLoaded();
infoTotal = _root["photograph"].getBytesTotal();
percentage = Math.floor(infoLoaded/infoTotal*100);
if (infoLoaded = infoTotal) {*/
_root.createEmptyMovieClip("mask", 100);
_global.newDepth++
_root.mask._x=0;
_root.mask._y=0;
_root.mask._alpha=100;
_root.mask.attachMovie("mask", "mask", 101);
_root["slide"].setMask(_root.mask);
//clearInterval(setFade);
//setFade=setInterval(fadeImage,2);
// };
//};
if(i‹images_array.length){createnewmovieclip();};
};
function switchPhotographs(){
loadPhoto();
};

var imagesXML:XML = new XML();
imagesXML.load("movieslide.xml");
imagesXML.ignoreWhite = true;
images_array = new Array();
imagecounter_array = new Array();
imagecounter=0;

imagesXML.onLoad = function(){
for (var i = 0; i var thisNode:XMLNode = imagesXML.firstChild.childNodes[i];
if (thisNode.nodeName=="movieslide_img"){
images_array.push(thisNode.attributes.image);
imagecounter++;
};
};
clearInterval(changePhoto);
changePhoto=setInterval(switchPhotographs,10);
currentarray=images_array;
};
//written by Steven Southard 12/4/2006


to top