Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant figure out how to define these variables correctly

Status
Not open for further replies.

whoknows361

Technical User
Sep 22, 2005
228
US
Hello all. been quite awhile since i've posted. but ran into a prob.

I am trying to set up a simple add item to cart function and evertyhing works below aside from the "paypal part". I ommitted my scroll function as its not necessary.

Code:
stop();


//functions***********************************
updatepos = function() {
	//moves next item row down and increased depth by one//
_root.beginy = _root.beginy + 87;
_root.depth = _root.depth +1;
_root.depth2 = _root.depth2 +1;
}

//************************************************************


var names:Array = ["Name1", "Name2", "Name3", "Name4", "Name5", "Name6", "Name7", "Name8", "Name9", "Name10"];
var productnumber:Array = ["Number1", "Number2","Number3","Number4","Number5","Number6","Number7","Number8","Number9","Number10"];
var price:Array = ["$1.00", "$2.00", "$3.00", "$4.00", "$5.00", "$6.00", "$7.00", "$8.00", "$9.00", "$10.00"];
var description:Array = ["desc1", "desc2", "desc3", "desc4", "desc5", "desc6", "desc7", "desc8", "desc9", "desc10"];

_root.depth = 500;
_root.depth2 = 1000;
_root.beginx = 0;
_root.beginy = 0;
_root.overallheight = 0;  //used to get the value of how far to scroll down for scroller
Tnumber= 10;

for(var i = 0; i < Tnumber; i++){ 
_root.counter = i;
var mc:MovieClip = _root.initialholder.holder.contents.attachMovie("partcontainer", "partcontainer"+i, _root.depth);
//positioning
mc._x = _root.beginx;
mc._y = _root.beginy; 
//filling in textboxe
//assigning and displaying text box values//
mc.name.text = names[i];
mc.partnumber.text = productnumber[i];
mc.price.text = price[i];
mc.description.text = description[i];

_root.overallheight = _root.overallheight - 60; //gives us the y value for the scroller to scroll down to.

//setup paypal button and presson info////the below paypal code doesn't work right//
mc.attachMovie("paypal_btn", "paypal_btn", _root.depth2);
mc.paypal_btn.onPress = function() {
	this.price = price[i];
	this.ID = names[i];
	this.name = names[i];
	this.option1Name = "Part#";
	this.option1Value = productnumber[i];
	this.addQuantity = 1;
	this.maxQuantity = 999;
	this.addToCart();

}
//call position function
updatepos();
}

the problem lies in the paypal section. You see the mc "partcontainer" is simply a mc showing the part name number, descr, etc. and within each "partcontatier+i" clip i want there to be my paypal_btn mc. each with its own specific name .. ie paypal_btn +i. and I want to be able to pass the price, ID, name, option1Name, option1VAlue, etc to each button... as each will be different. Can someone please give me an idea as to how I would do this. I feel like I am so close but am missing a simple idea. Please help

Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top