11-23-2004, 09:57 PM
|
#1
|
|
actionscript junkie
Join Date: Mar 2003
Location: dark alley
Posts: 489
|
simple math problem........
here goes... for a explination...... I'm trying to create a scrollable list with the typical up / down buttons and a scrollbar ...... I've got everything working except the middle scrollbar ...... some math formula I'm missing .... i'm trying to get the scrollbar to act as if its at top to move the scrollcontent to the top and if the scrollbar is at the bottom to show the last 12 items.... hope it makes sense......... now if that didnt ... maybe some code will.....
all AS and nothing ELSE
Code:
_root.aniPlay = 0;
//css
static_text_format_one = new TextFormat();
static_text_format_one.color = 0xFFFFFF;
//static_text_format_one.color = 0x000000;
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);
}
}
//..............................................................................
// 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, 350, 272, 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, 300, 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);
//
}
// }
//..............................
if (_root.basket.getTotal()>=12) {
_root.scrollthingie.createEmptyMovieClip("up_btn", 13);
_root.scrollthingie.up_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.up_btn._x = 316;
_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.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;
}
};
//
_root.scrollthingie.createEmptyMovieClip("center_bar", 15);
_root.scrollthingie.center_bar.drawBox(0, 0, 25, 220, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.center_bar._x = 316;
_root.scrollthingie.center_bar._y = 46;
//.............................................................................................................................................
_root.scrollthingie.createEmptyMovieClip("center_bar_scroll", 16);
_root.scrollthingie.center_bar_scroll._x = 318;
_root.scrollthingie.center_bar_scroll._y = 48;
_root.scrollthingie.center_bar_scroll.createEmptyMovieClip("center_bar_sm", 16);
//
newsizemx = _root.basket.getTotal()-12;
//
if (newsizemx>21) {
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, 6, 1, 0xFFFFFF, 0xA4A4A4, 100);
} else {
newsizemxsquared = 216-(newsizemx*10);
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, newsizemxsquared, 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, 216-newsizemxsquared);
};
_root.scrollthingie.center_bar_scroll.center_bar_sm.onRelease = function() {
this.stopDrag();
};
//
//.............................................................................................................................................
//
_root.scrollthingie.createEmptyMovieClip("dwn_btn", 14);
_root.scrollthingie.dwn_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.dwn_btn._x = 316;
_root.scrollthingie.dwn_btn._y = 273;
_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.dwn_btn.onPress = function() {
if (_root.scrollthingie.holder.scroll_content._y == (_root.basket.getTotal()-11)*-25) {
} else {
_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y-25;
}
};
}
}
//
createBox("scrollthingie", "[ X ] B A S K E T ", 8, 350, 295, 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();
paste into empty FLA and plublish if you dare
|
|
|
11-23-2004, 11:09 PM
|
#2
|
|
Off-Line
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
|
puh nearly don
now you need to make the scroler move when you use the buttons to scroll but this shoudn't by a to big problem
PHP Code:
_root.aniPlay = 0;
//css
static_text_format_one = new TextFormat();
static_text_format_one.color = 0xFFFFFF;
//static_text_format_one.color = 0x000000;
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);
}
}
//..............................................................................
// 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, 350, 272, 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, 300, 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);
//
}
// }
//..............................
if (_root.basket.getTotal()>=12) {
_root.scrollthingie.createEmptyMovieClip("up_btn", 13);
_root.scrollthingie.up_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.up_btn._x = 316;
_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.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;
}
};
//
_root.scrollthingie.createEmptyMovieClip("center_bar", 15);
_root.scrollthingie.center_bar.drawBox(0, 0, 25, 220, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.center_bar._x = 316;
_root.scrollthingie.center_bar._y = 46;
//.................................................................................................... .........................................
_root.scrollthingie.createEmptyMovieClip("center_bar_scroll", 16);
_root.scrollthingie.center_bar_scroll._x = 318;
_root.scrollthingie.center_bar_scroll._y = 48;
_root.scrollthingie.center_bar_scroll.createEmptyMovieClip("center_bar_sm", 16);
//
newsizemx = _root.basket.getTotal()-12;
//
if (newsizemx>21) {
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, 6, 1, 0xFFFFFF, 0xA4A4A4, 100);
} else {
newsizemxsquared = 216-(newsizemx*10);
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, newsizemxsquared, 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, 216-newsizemxsquared);
this.onEnterFrame = function() {
Q = this._y;
QQ = 216-newsizemxsquared;
QQQ = ((_root.basket.getTotal()-11)*-25)*(Q/QQ);
_root.scrollthingie.holder.scroll_content._y = QQQ;
};
//////////////////////////////////
////////////////////////
};
_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 = 316;
_root.scrollthingie.dwn_btn._y = 273;
_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.dwn_btn.onPress = function() {
if (_root.scrollthingie.holder.scroll_content._y == (_root.basket.getTotal()-11)*-25) {
} else {
_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y-25;
}
};
}
}
//
createBox("scrollthingie", "[ X ] B A S K E T ", 8, 350, 295, 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();
|
|
|
11-23-2004, 11:14 PM
|
#3
|
|
Meuh? MMeuh!
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,050
|
Ok I'll try myself to take your scroll function.
I made one but with no success...
héhéhé
__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...
|
|
|
11-24-2004, 12:05 AM
|
#4
|
|
actionscript junkie
Join Date: Mar 2003
Location: dark alley
Posts: 489
|
xeef thanks... thats what I was looking for... now if I could only get the math to move the scroll bar just right when the buttons are puished...... darn different size button ARG @%$#@()&%@_#%_#(%@#(% make to pencil and paper...
|
|
|
11-24-2004, 03:18 PM
|
#5
|
|
Off-Line
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
|
Hmmm
this isn't prefect  it will by corect as long the middle scroler is at the top or at the bottom
i REALY mis som sort of a PIONTER or so WHICH position the list have in the moment
eg. top in the list is ITEM X i don't think you will manege this whit out this info how ever you implement it so the easyest woud by make streight somthing like
_root.basket.getTopItem() which give the TopItme in the visual list back
PHP Code:
_root.aniPlay = 0;
//css
static_text_format_one = new TextFormat();
static_text_format_one.color = 0xFFFFFF;
//static_text_format_one.color = 0x000000;
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);
}
}
//..............................................................................
// 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, 350, 272, 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, 300, 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);
//
}
// }
//..............................
if (_root.basket.getTotal()>=12) {
_root.scrollthingie.createEmptyMovieClip("up_btn", 13);
_root.scrollthingie.up_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.up_btn._x = 316;
_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.up_btn.onPress = function() {
if (_root.scrollthingie.holder.scroll_content._y == 0) {
} else {
Q = _root.scrollthingie.center_bar_scroll.center_bar_sm._y;
QQ = (315-newsizemxsquared)/_root.basket.getTotal();
_root.scrollthingie.center_bar_scroll.center_bar_sm._y -= QQ;
_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y+25;
}
};
//
_root.scrollthingie.createEmptyMovieClip("center_bar", 15);
_root.scrollthingie.center_bar.drawBox(0, 0, 25, 220, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.center_bar._x = 316;
_root.scrollthingie.center_bar._y = 46;
//.................................................................................................... .........................................
_root.scrollthingie.createEmptyMovieClip("center_bar_scroll", 16);
_root.scrollthingie.center_bar_scroll._x = 318;
_root.scrollthingie.center_bar_scroll._y = 48;
_root.scrollthingie.center_bar_scroll.createEmptyMovieClip("center_bar_sm", 16);
//
newsizemx = _root.basket.getTotal()-12;
//
if (newsizemx>21) {
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, 6, 1, 0xFFFFFF, 0xA4A4A4, 100);
} else {
newsizemxsquared = 216-(newsizemx*10);
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, newsizemxsquared, 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, 216-newsizemxsquared);
this.onEnterFrame = function() {
Q = this._y;
QQ = 216-newsizemxsquared;
QQQ = ((_root.basket.getTotal()-11)*-25)*(Q/QQ);
_root.scrollthingie.holder.scroll_content._y = QQQ;
};
//////////////////////////////////
////////////////////////
};
_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 = 316;
_root.scrollthingie.dwn_btn._y = 273;
_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.dwn_btn.onPress = function() {
if (_root.scrollthingie.holder.scroll_content._y == (_root.basket.getTotal()-11)*-25) {
} else {
//////
Q = _root.scrollthingie.center_bar_scroll.center_bar_sm._y;
QQ = (315-newsizemxsquared)/_root.basket.getTotal();
_root.scrollthingie.center_bar_scroll.center_bar_sm._y += QQ;
/////
_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y-25;
}
};
}
}
//
createBox("scrollthingie", "[ X ] B A S K E T ", 8, 350, 295, 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();
P.S
Normaly i not like to play whit so big code around but i realy like stoff which is just code and not attach here load there
nice work
|
|
|
11-24-2004, 04:22 PM
|
#6
|
|
Freelance web developer
Join Date: Oct 2004
Posts: 175
|
Well done  . This must have been time consuming how long did it take for you to acomplish this task? Well done
|
|
|
11-24-2004, 07:32 PM
|
#7
|
|
actionscript junkie
Join Date: Mar 2003
Location: dark alley
Posts: 489
|
time consuming for that ammount of code.. not really.... you should see the code from the project that this little bit came from ... close to 8000 lines in main project  all code and nothing on the stage... the way to go....
|
|
|
11-24-2004, 07:46 PM
|
#8
|
|
Off-Line
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
|
 i like code WHITOUT anything on the stage SOooooo much !
GREAT WORK !!!
|
|
|
11-24-2004, 09:28 PM
|
#9
|
|
Off-Line
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
|
Hmmmmm
i think i have done it !!!
PHP Code:
_root.aniPlay = 0;
//css
static_text_format_one = new TextFormat();
static_text_format_one.color = 0xFFFFFF;
//static_text_format_one.color = 0x000000;
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);
}
}
//..............................................................................
// 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, 350, 272, 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, 300, 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);
//
}
// }
//..............................
if (_root.basket.getTotal()>=12) {
_root.scrollthingie.createEmptyMovieClip("up_btn", 13);
_root.scrollthingie.up_btn.drawBox(0, 0, 25, 15, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.up_btn._x = 316;
_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, 220, 1, 0xFFFFFF, 0x000000, 100);
_root.scrollthingie.center_bar._x = 316;
_root.scrollthingie.center_bar._y = 46;
//.................................................................................................... .........................................
_root.scrollthingie.createEmptyMovieClip("center_bar_scroll", 16);
_root.scrollthingie.center_bar_scroll._x = 318;
_root.scrollthingie.center_bar_scroll._y = 48;
_root.scrollthingie.center_bar_scroll.createEmptyMovieClip("center_bar_sm", 16);
//
newsizemx = _root.basket.getTotal()-12;
//
if (newsizemx>21) {
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, 6, 1, 0xFFFFFF, 0xA4A4A4, 100);
} else {
newsizemxsquared = 216-(newsizemx*10);
_root.scrollthingie.center_bar_scroll.center_bar_sm.drawBox(0, 0, 21, newsizemxsquared, 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, 216-newsizemxsquared);
this.onEnterFrame = function() {
Q = this._y;
QQ = 216-newsizemxsquared;
QQQ = ((_root.basket.getTotal()-11)*-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 = 316;
_root.scrollthingie.dwn_btn._y = 273;
_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 = 216-newsizemxsquared;
QQ = Q/((_root.basket.getTotal()-11)*-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()-11)*-25) {
} else {
_root.scrollthingie.holder.scroll_content._y = _root.scrollthingie.holder.scroll_content._y-25;
//////
Q = 216-newsizemxsquared;
QQ = Q/((_root.basket.getTotal()-11)*-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, 350, 295, 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();
P.S.
i have move the
dwn_btn.onPress & up_btn.onPress (it was realy stressi to make a so big jump in code to work whit them)
|
|
|
11-24-2004, 10:52 PM
|
#10
|
|
Meuh? MMeuh!
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,050
|
Ok, so could you make this code usuable whatever the size or _x / _y of the container needed to be scroll?
Will help me much
C ya
__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Hybrid Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 08:23 AM.
///
|
|