Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-24-2004, 11:05 PM   #11
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

Hmmmm do you asking my or scot ?

if you asking my Hmmmm i not even now how to set the _x or _y of the container
not realy look inside the code just on the parts which was important for the above but
i think it shoud also work whit diferent _x _y by diferent _xscale/_widht definetly
by _yscale/_height not sure
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 11-24-2004, 11:09 PM   #12
scot
actionscript junkie
 
scot's Avatar
 
Join Date: Mar 2003
Location: dark alley
Posts: 489
Default

xeef is the man.... thanks XEEF ... so glad one of my all AS dabbles finally got some assitance and might be useful to many ..... there needs to be a forum for nothing but all AS scripts... dabbles.... projects..........etc... time to move onto the next dabble... thanks again xeef........
scot is offline   Reply With Quote
Old 11-25-2004, 12:01 AM   #13
scot
actionscript junkie
 
scot's Avatar
 
Join Date: Mar 2003
Location: dark alley
Posts: 489
Default

oh _x _y .. been playing with that ideas.. thats nice... any more ideas.... for this beast of code....

Code:
//........................................................................................................................................................................
//........................................................................................................................................................................
// a actionscript.org script EVOLUTION... thanks to XEEFs help ........... for getting the scroll working smoothly.. nice math skills... :)
//
// if u use this script share with its _root._parents...... what it was used for ......
//
// _root._parents... ????? scot &    xeef 
//........................................................................................................................................................................
//........................................................................................................................................................................
// windows height
maskhgt = 600;
//  windows width
windowwdt = 600
//
//
_root.aniPlay = 0;
windowhgt = maskhgt+23;
totvisitemz = (maskhgt/25);

//css
static_text_format_one = new TextFormat();
static_text_format_one.color = 0xFFFFFF;
static_text_format_one.bullet = 0;
static_text_format_one.underline = 0;
static_text_format_one.font = "hooge 05_63";
static_text_format_one.size = 8;
//..............................................................................
// drawing API
//..............................................................................
MovieClip.prototype.drawBox = function(x, y, w, h, lineWidth, lineColor, bgColor, bgAlpha) {
	this.beginFill(bgColor, bgAlpha);
	this.lineStyle(lineWidth, lineColor, 100);
	this.moveTo(x, y);
	this.lineTo(x+w, y);
	this.lineTo(x+w, y+h);
	this.lineTo(x, y+h);
	this.endFill();
};
//
function createBox(n, t, l, w, h, x, y, l_color, b_color, xhead) {
	this.createEmptyMovieClip(n, l);
	this[n]._x = x;
	this[n]._y = y;
	this[n].drawBox(0, 0, w, h, 1, l_color, b_color, 40);
	this[n].drawBox(2, 2, w-4, h-4, 1, l_color, b_color, 40);
	if (xhead) {
		this[n].drawBox(4, 4, w-8, 15, 1, l_color, b_color, 40);
	}
	this[n].createTextField("stat", 1, 4, 4, 150, 50);
	this[n].stat.multiline = true;
	this[n].stat.selectable = 0;
	this[n].stat.wordWrap = true;
	this[n].stat.border = false;
	this[n].stat.setTextFormat(static_text_format_one);
	fadeIt(t, n);
	this[n].fadeIn();
}
//..............................................................................
// text animation
//..............................................................................
function fadeIt(dText, whatmc) {
	numba = 0;
	status = "";
	max = dText.length;
	newNum = 0;
	fadeInte = setInterval(anim2, 25, numba, dText, max, whatmc);
}
function anim2(numba, dText, max, whatmc) {
	if (newNum>max) {
		clearInterval(fadeInte);
		_root.aniPlay = "done";
	} else {
		_root.aniPlay = true;
		newNum += numba+1;
		numba = newNum;
		outPut2 = substring(dText, newNum, 1);
		status = status+outPut2;
		_root[whatmc+""].stat.text = status;
		_root[whatmc+""].stat.setTextFormat(static_text_format_one);
	}
}
//

///////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.fadeIn = function(s) {
	this._alpha = 0;
	this._s = s ? s : 10;
	this.fade = function() {
		if (this._alpha<=100) {
			this._alpha += this._s;
		} else {
			clearInterval(this._fadeID);
		}
	};
	this._fadeID = setInterval(this, "fade", 10);
};
//..............................................................................
// Basket object to store the items.
//..............................................................................
function Basket() {
	this.sum = 0;
	this.shipw = 0;
	this.itemx = new Array();
}
Basket.prototype.insertItem = function(pid, what, price, qty) {
	temp = new Array(pid, what, price, qty);
	this.itemx.push(temp);
	this.sum += Number(price);
	drawscrollablecontents();
};
Basket.prototype.returnList = function(x, y) {
	return this.itemx[x][y];
};
Basket.prototype.getSum = function() {
	return this.sum;
};
Basket.prototype.getTotal = function() {
	return this.itemx.length;
};
//..............................................................................
function drawscrollablecontents() {
	// basket status
	_root.scrollthingie.createTextField("xstat", 10, 265, 5, 150, 15);
	_root.scrollthingie.xstat.multiline = 0;
	_root.scrollthingie.xstat.selectable = 0;
	_root.scrollthingie.xstat.wordWrap = true;
	_root.scrollthingie.xstat.border = false;
	if (_root.basket.getTotal() == 1) {
		_root.scrollthingie.xstat.text = _root.basket.getTotal()+"   I T E M";
		_root.scrollthingie.xstat.setTextFormat(static_text_format_one);
	} else if (_root.basket.getTotal()>1) {
		_root.scrollthingie.xstat.text = _root.basket.getTotal()+"   I T E M S";
		_root.scrollthingie.xstat.setTextFormat(static_text_format_one);
	}
	//
	_root.scrollthingie.createEmptyMovieClip("holder", 11);
	_root.scrollthingie.holder._x = 10;
	_root.scrollthingie.holder._y = 21;
	_root.scrollthingie.holder.createEmptyMovieClip("scroll_content", 10);
	_root.scrollthingie.createEmptyMovieClip("holder_mask", 12);
	_root.scrollthingie.holder_mask.drawBox(0, 0, windowwdt, maskhgt, 1, 0x000000, 0xFF0000, 100);
	_root.scrollthingie.holder_mask._y = 21;
	_root.scrollthingie.holder.setMask(_root.scrollthingie.holder_mask);
	//    trace(_root.basket.getTotal()+":::");
	for (z=0; z<_root.basket.getTotal(); z++) {
		_root.scrollthingie.holder.scroll_content.createEmptyMovieClip("item_mc"+z, 10+z);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].drawBox(0, 0, windowwdt-50, 20, 1, 0xFFFFFF, 0x000000, 100);
		_root.scrollthingie.holder.scroll_content["item_mc"+z]._y = z*25;
		//
		_root.scrollthingie.holder.scroll_content["item_mc"+z].createTextField("stat", 3, 1, 1, 15, 15);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.multiline = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.selectable = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.wordWrap = true;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.border = false;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.text = z;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].stat.setTextFormat(static_text_format_two);
		//
		_root.scrollthingie.holder.scroll_content["item_mc"+z].createTextField("desc", 4, 16, 1, 150, 15);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.multiline = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.selectable = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.wordWrap = true;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.border = false;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.text = _root.basket.returnList(z, 1);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].desc.setTextFormat(static_text_format_one);
		//
		_root.scrollthingie.holder.scroll_content["item_mc"+z].createTextField("prc", 5, 260, 1, 150, 15);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.multiline = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.selectable = 0;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.wordWrap = true;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.border = false;
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.text = _root.basket.returnList(z, 2);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].prc.setTextFormat(static_text_format_one);
		_root.scrollthingie.holder.scroll_content["item_mc"+z].fadeIn()
		//
	}
	//    }
	//..............................
	if (_root.basket.getTotal()>=totvisitemz) {
		_root.scrollthingie.createEmptyMovieClip("up_btn", 13);
		_root.scrollthingie.up_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
		_root.scrollthingie.up_btn._x = windowwdt-34;
		_root.scrollthingie.up_btn._y = 24;
		_root.scrollthingie.up_btn.onRollOver = function() {
			this._x = this._x+2;
			this._y = this._y+2;
		};
		_root.scrollthingie.up_btn.onRollOut = function() {
			this._x = this._x-2;
			this._y = this._y-2;
		};
		//
		_root.scrollthingie.createEmptyMovieClip("center_bar", 15);
		_root.scrollthingie.center_bar.drawBox(0, 0, 25, maskhgt-52, 1, 0xFFFFFF, 0x000000, 100);
		_root.scrollthingie.center_bar._x = windowwdt-34;
		_root.scrollthingie.center_bar._y = 46;
		//....................................................................................................        .........................................
		_root.scrollthingie.createEmptyMovieClip("center_bar_scroll", 16);
		_root.scrollthingie.center_bar_scroll._x = windowwdt-32;
		_root.scrollthingie.center_bar_scroll._y = 48;
		_root.scrollthingie.center_bar_scroll.createEmptyMovieClip("center_bar_sm", 16);
//
		if (_root.basket.getTotal()>totvisitemz) {
			newsizemx = _root.basket.getTotal()-totvisitemz;
			newsizemxsquared = (maskhgt-56)-(newsizemx*10);
			if (newsizemxsquared<10) {
				_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, 6, 1, 0xFFFFFF, 0xA4A4A4, 100);
			} else {
				_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, newsizemxsquared, 1, 0xFFFFFF, 0xA4A4A4, 100);
			}
		} else {
			_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, maskhgt-56, 1, 0xFFFFFF, 0xA4A4A4, 100);
		}
		//
		_root.scrollthingie.center_bar_scroll.center_bar_sm.onRollOver = function() {
			this._x = this._x+1;
			this._y = this._y+1;
		};
		_root.scrollthingie.center_bar_scroll.center_bar_sm.onRollOut = function() {
			this._x = this._x-1;
			this._y = this._y-1;
		};
		_root.scrollthingie.center_bar_scroll.center_bar_sm.onPress = function() {
			this.startDrag(0, 0, 0, 0, (maskhgt-56)-newsizemxsquared);
			this.onEnterFrame = function() {
				Q = this._y;
				QQ = (maskhgt-56)-newsizemxsquared;
				QQQ = ((_root.basket.getTotal()-totvisitemz)*-25)*(Q/QQ);
				_root.scrollthingie.holder.scroll_content._y = int(QQQ/25)*25;
			};
			//////////////////////////////////
			////////////////////////
		};
		_root.scrollthingie.center_bar_scroll.center_bar_sm.onRelease = function() {
			this.stopDrag();
			delete this.onEnterFrame;
		};
		//
		//....................................................................................................        .........................................
		//
		_root.scrollthingie.createEmptyMovieClip("dwn_btn", 14);
		_root.scrollthingie.dwn_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
		_root.scrollthingie.dwn_btn._x = windowwdt-34;
		_root.scrollthingie.dwn_btn._y = maskhgt-1;
		_root.scrollthingie.dwn_btn.onRollOver = function() {
			this._x = this._x+2;
			this._y = this._y+2;
		};
		_root.scrollthingie.dwn_btn.onRollOut = function() {
			this._x = this._x-2;
			this._y = this._y-2;
		};
		_root.scrollthingie.up_btn.onPress = function() {
			if (_root.scrollthingie.holder.scroll_content._y == 0) {
			} else {
				_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y+25;
				Q = (maskhgt-56)-newsizemxsquared;
				QQ = Q/((_root.basket.getTotal()-totvisitemz)*-25);
				QQQ = -Math.abs(_root.scrollthingie.holder.scroll_content._y);
				_root.scrollthingie.center_bar_scroll.center_bar_sm._y = QQ*QQQ;
			}
		};
		_root.scrollthingie.dwn_btn.onPress = function() {
			if (_root.scrollthingie.holder.scroll_content._y == (_root.basket.getTotal()-totvisitemz)*-25) {
			} else {
				_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y-25;
				//////
				Q = (maskhgt-56)-newsizemxsquared;
				QQ = Q/((_root.basket.getTotal()-totvisitemz)*-25);
				QQQ = -Math.abs(_root.scrollthingie.holder.scroll_content._y);
				_root.scrollthingie.center_bar_scroll.center_bar_sm._y = QQ*QQQ;
				/////
			}
		};
	}
}

//
createBox("scrollthingie", "[ X ]  B A S K E T ", 8, windowwdt, windowhgt, 200, 50, 0xFFFFFF, 0x000000, 1);
_root.basket = new Basket();
//
_root.xtmpvar = 0;
_root.createEmptyMovieClip("add_btn", 20);
_root.add_btn.drawBox(0, 0, 140, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.add_btn._x = 200;
_root.add_btn._y = 5;
_root.add_btn.onRollOver = function() {
	this._x = this._x+2;
	this._y = this._y+2;
};
_root.add_btn.onRollOut = function() {
	this._x = this._x-2;
	this._y = this._y-2;
};
_root.add_btn.onPress = function() {
	//	trace("ADD");
	_root.xtmpvar++;
	_root.basket.insertItem(_root.xtmpvar, "I T E M  "+_root.xtmpvar, _root.xtmpvar, 1);
};
_root.add_btn.createTextField("dtf", 5, 2, 1, 150, 15);
_root.add_btn.dtf.multiline = 0;
_root.add_btn.dtf.selectable = 0;
_root.add_btn.dtf.wordWrap = true;
_root.add_btn.dtf.border = false;
_root.add_btn.dtf.text = " A D D  2  B A S K E T";
_root.add_btn.dtf.setTextFormat(static_text_format_one);
//
stop();
,,,,,,,, how about set size to the boxes that are being scrolled... well the height.... width done all ready....... NEED MORE INPUT ......... i add a fadeIn prototype but not the desired effect I was looking for........
scot is offline   Reply With Quote
Old 11-25-2004, 01:14 AM   #14
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

hi scot

not sure and i am to lazi to test but i think (not sure)
-Math.abs(_root.scrollthingie.......
the "-" and the Math.abs can by let away
i was playing whit in diferent directions and forget to erease it
but i think it will by always "-" so no need to convert it to neutral and make it "-" again


What a nice creadit on my first when i was look on it a was nearly thinking the hole thing is from my

i woud have newer done this work when it's wasent look so nice from the begining it's seldem to see nice and competent work
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:01 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.