Jump to content


Photo

Help changing timeline values from dates to text


  • Please log in to reply
No replies to this topic

#1 DominikJ

DominikJ

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 10 February 2011 - 12:43 PM

I recently bought a flash template and i'm now in the process of editting it to fit my needs.

I'm no expert in actionscript, I can figure some things out but once things get complex I get a bit lost. That leaves me here looking for help!

You can see the template here

The template has a timeline at the bottom of the page. The dates are dynamic based on the data in the boxes above it. If you have 3 boxes, one dated 2011, one 2010, one 2009 it will fill the timeline from 2009 to 2011.

I want to change the timeline from numbers to text. For example, if I were to put Baseball in one box, Football in the next, and Soccer in the other I want the timeline to show:
-----|----------|------------|
Baseball Football Soccer

Here is the AS code below. Any help on this issue would be much appreciated. If you have any questions, PM me and we can discuss them there.

//---------------------------------------------------------TimeLine
function _yrOvrF(param1:MouseEvent) {
	param1.target.txt.textColor = 16711680;
}
function _yrOutF(param1:MouseEvent)
{
	param1.target.txt.textColor = 16777215;
}
function _yrClckInitF(e:MovieClip):void {
	e.buttonMode = true;
	e.mouseChildren = false;
	e.addEventListener(MouseEvent.ROLL_OVER, _yrOvrF);
	e.addEventListener(MouseEvent.ROLL_OUT, _yrOutF);
	e.addEventListener(MouseEvent.CLICK, _fThmbPrsF);
}
var totYer:Number;
var _tmLneArr:Array=new Array();
function _tlmeLnInit() {
	var m:MovieClip;
	_tmLnMc.dragging = false;
	_tmLnMc.len = _tmLnMc._lneMc.width;
	_tmLnMc.initX =  0;
	//-----Timeline Date Push-------
	_tmLnMc._mxYer = int(Math.max.apply(null, _tmeLneArr).toString().substr(0, 4)) + 1;
	_tmLnMc._minYer = int(Math.min.apply(null, _tmeLneArr).toString().substr(0, 4));

	var _totYer = _tmLnMc._mxYer - _tmLnMc._minYer;
	var _avgYer = _tmLnMc.len / (_totYer * 12);

	m = new _yerTxtM();
	m.x = _tmLnMc.initX + _tmLnMc.len;
	m.txt.text = _tmLnMc._mxYer;

	_yrClckInitF(m);
	_tmLnMc.addChild(m);
	
	_tmLneArr.push(m);
	
	for(var t:int=0;t<_totYer * 12;t++){
		if (t % 12 == 0) {
			m = new _yerTxtM();
			m.txt.text =_tmLnMc._minYer + t / 12;
			_yrClckInitF(m);
			_tmLneArr.push(m);
		} else {
			m = new _yerSepM();
		}
		m.x = _tmLnMc.initX + _avgYer * t;
		_tmLnMc.addChild(m);
	}
	//-----End Timeline Date Push-------
	var _drgrMc:_drgrM = new _drgrM();
	_drgrMc.x=_tmLnMc.len;
	_drgrMc.name = "_crclMc";
	_drgrMc.addEventListener(MouseEvent.MOUSE_DOWN, _drgrOvr);
	stage.addEventListener(MouseEvent.MOUSE_UP, _drgrOut);
	_tmLnMc.addChild(_drgrMc);
	var _drpShdw = new DropShadowFilter(3, 45, 0, 0.7, 3, 3, 1, 1);
	_drgrMc.filters = [_drpShdw];

}





1 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


    Bing (1)