Scrollbar with intertia Actionscript 2.0

var item_title:Array = new Array();
var item_url:Array = new Array();
var item_description:Array = new Array();
var total:Number;
var i:Number = 0;
var p:Number = 0;
var item_spacing:Number = 10;
var scrolling_speed:Number = 0.30; // 0.00 to 1.00
var cv:Number = 0;
var cv_old:Number = 0;
var on_drag:Boolean;
var xml:XML = new XML();
item_list_area._visible = false;
item_list.setMask(item_mask);
stop();

xml.onLoad = function()
{
item_list.fm_item._visible = false;
var nodes = this.firstChild.childNodes;
total = nodes.length;

for( i = 0; i < total; i++)
{
item_title[i] = nodes[i].attributes.title;
item_url[i] = nodes[i].attributes.url;
item_description[i] = nodes[i].attributes.description;
}
create_item_list();
scroller();
}
xml.load( “flashmo_077_news.xml” );
xml.ignoreWhite = true;
function create_item_list():Void
{
for( i = 0; i < total; i++)
{
var item = item_list.fm_item.duplicateMovieClip(“fm_item”+i, i);
item._y = i * (item_list.fm_item._height + item_spacing);
item.item_title.text = item_title[i];
item.item_description.text = item_description[i];
item.no = i;

item.item_button.onRelease = function()
{
getURL(item_url[this._parent.no]);
}
}
}
function scroller():Void
{
scroller_mc._y = scrollable_area_mc._y;
item_list._y = item_list_area._y;
sr = item_list_area._height/item_list._height;
scroller_mc._height = scrollable_area_mc._height * sr;
sd = scrollable_area_mc._height – scroller_mc._height;
cd = item_list._height – item_list_area._height;
cr = cd / sd;

if( item_list._height <= item_list_area._height )
{
scroller_mc._visible = scrollable_area_mc._visible = false;
}
else
{
scroller_mc._visible = scrollable_area_mc._visible = true;
}
scroller_mc.onPress = function()
{
this.startDrag(false, this._x, scrollable_area_mc._y, this._x,
scrollable_area_mc._y + scrollable_area_mc._height – this._height);
on_drag = true;
this.onEnterFrame = function()
{
new_y = item_list_area._y + scrollable_area_mc._y*cr – this._y*cr;
cv = (new_y – item_list._y) * scrolling_speed;
item_list._y += cv;
if( on_drag == false && cv_old == cv )
delete this.onEnterFrame;
cv_old = cv;
}
}
scroller_mc.onRelease = scroller_mc.onReleaseOutside = function()
{
this.stopDrag();
on_drag = false;
}
}

Actionscript Gallore

http://blog.greensock.com/category/preloading/

http://www.kirupa.com/forum/showthread.php?t=277424

http://www.actionscriptclasses.com/category/as-2/page/2/

http://blog.greensock.com/tweenliteas2

http://candymandesign.blogspot.com/

parsing xml in flash

import ginner.GDispatcher
class flashdb.utils.ParserXML extends XML {
var target:MovieClip
var xmlobj:XML
var lista:Array
var ref:Object

public var addEventListener:Function;
public var removeEventListener:Function;
private var dispatchEvent:Function;

function ParserXML (targ:MovieClip, list:Array,
URI:String) {

if (!arguments) {
return;
}
GDispatcher.initialize(this);
target = targ
lista = list

xmlobj = new XML();
xmlobj[“ref”] = this;
trace (this);
xmlobj.ignoreWhite = true;
xmlobj.onLoad = onLoad;
xmlobj.load(URI);
}
function onLoad (success) {
if (success) {

var nodeXML:XML = this;
if (nodeXML.firstChild.childNodes.length!=null) {
//trace (nodeXML.childNodes[0]);
//trace (nodeXML.childNodes[1]);
//var Childvalue = “childNodes[1]”;

for (var i:Number = 0; i<nodeXML.firstChild.childNodes.length;i++){

var obj:Object = new Object()
for (var j in nodeXML.childNodes[1].childNodes[i].attributes) {
obj[j] = String(nodeXML.childNodes[1].childNodes[i].attributes[j]);

}
this.ref.lista.push(obj)
}
this.ref.dispatchEvent({target:this.ref.target, type:’onloadFinished’});
}
}else{
this.ref.dispatchEvent({target:this.ref.target, type:’onloadError’});
}

}

}

Simple photo gallery

http://www.flash-db.com/Tutorials/simplegallery/

Simple photo gallery
Author by Dan Loaiza (papachan)

Hi guys been looking for a flash photo gallery, I just found a neat one… just visit the above link..

Experimental Game

http://imonline.alpha-phi-epsilon.net/_labs/game_01.html

hey guys… I donno why I made this freaking game, out of boredom, I made this game… The engine is not very throughly done… but its a worth trying for…