Cyber_Cus2
asked on
put loadVariables twice
Is that any matter if i use the same loadVariables many times? for example i use loadVariables("addbuy.asp" , "", "POST"); then i create a movieclip and i put that loadVariable again inside movieclip.
no, why?
ASKER
coz it seems make my action script error. I make a view trolley. It slides up and down. When it goes up, I put loadvariables and then display the data from asp. I put close button in the top of it and when I press it, I put all the data from the asp in _x = 2000 so they disappear from the screen. When I press the view trolley button again, it will play the same frames again. My problem is: when I open for the first time, it is blank like no data from asp, but when I close and open again, it works well. I close it and open again, it becomes NaN.
// depth
depth = -100;
depth1 = 500;
depth2 = 100;
// split up the array by looking for the commas
Prod_array2 = prodID.split(",");
Item_array2 = Items.split(",");
Price_array2 = Prices.split(",");
Qty_array2 = quantity.split(",");
// get the length of the array
Prod_length2 = Prod_array2.length;
Item_length2 = Item_array2.length;
Price_length2 = Price_array2.length;
Qty_length2 = Qty_array2.length;
// set the start y position (x position depends on where you put it on the screen)
Prod_yposition = 0;
Item_yposition = 50;
Price_yposition = 70;
Qty_yposition = 70;
totalPrice_yposition = 70;
pic_yposition = 50;
pic_xposition = 680;
chk_yposition = 90
myformat1 = new TextFormat();
myformat1.font = "Arial Black";
myformat1.size = 12;
myformat1.align = "left"
myformat2 = new TextFormat();
myformat2.font = "Arial Black";
myformat2.size = 12;
myformat2.align = "right"
Total_Record2 = Prod_length2 - 1;
// looping everything
for (i=0; i<Total_Record2; i++) {
_root.createEmptyMovieClip ("pic_mc2" +i, depth1);
_root["pic_mc2"+i].loadMov ie("images /" +prod_array2[i] + ".jpg");
_root["pic_mc2"+i]._y = pic_yposition;
_root["pic_mc2"+i]._x = pic_xposition;
_root["pic_mc2"+i]._xscale = 35;
_root["pic_mc2"+i]._yscale = 35;
_root.createEmptyMovieClip ("prod_mc2 "+i, depth);
_root["prod_mc2"+i].create TextField( "Item_txt2 ", 1, 760, Item_yposition, 120, 20);
_root["prod_mc2"+i].Item_t xt2.border = false;
_root["prod_mc2"+i].Item_t xt2.type = "dynamic";
_root["prod_mc2"+i].Item_t xt2.text = Item_array2[i];
_root["prod_mc2"+i].Item_t xt2.setTex tFormat(my format1);
_root["prod_mc2"+i].create TextField( "Qty_txt2" , 2, 760, Qty_yposition, 40, 25);
_root["prod_mc2"+i].Qty_tx t2.border = true;
_root["prod_mc2"+i].Qty_tx t2.type = "input";
_root["prod_mc2"+i].Qty_tx t2.text = Qty_array2[i];
_root["prod_mc2"+i].Qty_tx t2.setText Format(myf ormat2);
_root["prod_mc2"+i].create TextField( "dollar_tx t2", 3, 805, Qty_yposition, 55, 25);
_root["prod_mc2"+i].dollar _txt2.bord er = false;
_root["prod_mc2"+i].dollar _txt2.type = "dynamic";
_root["prod_mc2"+i].dollar _txt2.text = "@ $";
_root["prod_mc2"+i].dollar _txt2.setT extFormat( myformat2) ;
_root["prod_mc2"+i].create TextField( "Price_txt 2", 4, 860, Price_yposition, 40, 20);
_root["prod_mc2"+i].Price_ txt2.borde r = false;
_root["prod_mc2"+i].Price_ txt2.type = "dynamic";
_root["prod_mc2"+i].Price_ txt2.text = Price_array2[i];
_root["prod_mc2"+i].Price_ txt2.setTe xtFormat(m yformat2);
totPrice = Price_array2[i] * Qty_array2[i];
_root["prod_mc2"+i].create TextField( "totPrice_ txt2", 5, 910, totalPrice_yposition, 40, 20);
_root["prod_mc2"+i].totPri ce_txt2.bo rder = false;
_root["prod_mc2"+i].totPri ce_txt2.ty pe = "dynamic";
_root["prod_mc2"+i].totPri ce_txt2.te xt = totPrice;
_root["prod_mc2"+i].totPri ce_txt2.se tTextForma t(myformat 2);
depth--;
depth1++;
depth2++;
Prod_yposition = prod_yposition+80;
Item_yposition = Item_yposition+80;
Price_yposition = Price_yposition+80;
Qty_yposition = Qty_yposition+80;
totalPrice_yposition = totalPrice_yposition+80;
pic_yposition = pic_yposition+80;
}
stop();
this code make me stress man!!! ;((
// depth
depth = -100;
depth1 = 500;
depth2 = 100;
// split up the array by looking for the commas
Prod_array2 = prodID.split(",");
Item_array2 = Items.split(",");
Price_array2 = Prices.split(",");
Qty_array2 = quantity.split(",");
// get the length of the array
Prod_length2 = Prod_array2.length;
Item_length2 = Item_array2.length;
Price_length2 = Price_array2.length;
Qty_length2 = Qty_array2.length;
// set the start y position (x position depends on where you put it on the screen)
Prod_yposition = 0;
Item_yposition = 50;
Price_yposition = 70;
Qty_yposition = 70;
totalPrice_yposition = 70;
pic_yposition = 50;
pic_xposition = 680;
chk_yposition = 90
myformat1 = new TextFormat();
myformat1.font = "Arial Black";
myformat1.size = 12;
myformat1.align = "left"
myformat2 = new TextFormat();
myformat2.font = "Arial Black";
myformat2.size = 12;
myformat2.align = "right"
Total_Record2 = Prod_length2 - 1;
// looping everything
for (i=0; i<Total_Record2; i++) {
_root.createEmptyMovieClip
_root["pic_mc2"+i].loadMov
_root["pic_mc2"+i]._y = pic_yposition;
_root["pic_mc2"+i]._x = pic_xposition;
_root["pic_mc2"+i]._xscale
_root["pic_mc2"+i]._yscale
_root.createEmptyMovieClip
_root["prod_mc2"+i].create
_root["prod_mc2"+i].Item_t
_root["prod_mc2"+i].Item_t
_root["prod_mc2"+i].Item_t
_root["prod_mc2"+i].Item_t
_root["prod_mc2"+i].create
_root["prod_mc2"+i].Qty_tx
_root["prod_mc2"+i].Qty_tx
_root["prod_mc2"+i].Qty_tx
_root["prod_mc2"+i].Qty_tx
_root["prod_mc2"+i].create
_root["prod_mc2"+i].dollar
_root["prod_mc2"+i].dollar
_root["prod_mc2"+i].dollar
_root["prod_mc2"+i].dollar
_root["prod_mc2"+i].create
_root["prod_mc2"+i].Price_
_root["prod_mc2"+i].Price_
_root["prod_mc2"+i].Price_
_root["prod_mc2"+i].Price_
totPrice = Price_array2[i] * Qty_array2[i];
_root["prod_mc2"+i].create
_root["prod_mc2"+i].totPri
_root["prod_mc2"+i].totPri
_root["prod_mc2"+i].totPri
_root["prod_mc2"+i].totPri
depth--;
depth1++;
depth2++;
Prod_yposition = prod_yposition+80;
Item_yposition = Item_yposition+80;
Price_yposition = Price_yposition+80;
Qty_yposition = Qty_yposition+80;
totalPrice_yposition = totalPrice_yposition+80;
pic_yposition = pic_yposition+80;
}
stop();
this code make me stress man!!! ;((
ASKER
I think i should use removeMovieClip. Is that correct? Base on my code. Can you give me 1 example how to use removeMovieclip? should i use remove textfield as well?? i've tried to put removeMovieclip in the close button, but it doesn't work.
on (release) {
gotoAndStop("close");
for (i=0; i<Total_Record2; i++)
{
_root.removeMovieClip("pic _mc2"+i, depth);
}
}
on (release) {
gotoAndStop("close");
for (i=0; i<Total_Record2; i++)
{
_root.removeMovieClip("pic
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The removeMovieclip is working now, thank you
gotoAndStop("close"); is to close the area of the view trolley ( slide down). I still confuse what u just said (but I think you should load data only once) where should i put the action that load the data only once? in the button that opens the view trolley or in frame inside movieclip? or may be i should use if statement as well?
gotoAndStop("close"); is to close the area of the view trolley ( slide down). I still confuse what u just said (but I think you should load data only once) where should i put the action that load the data only once? in the button that opens the view trolley or in frame inside movieclip? or may be i should use if statement as well?
>in the button that opens the view trolley or in frame inside movieclip? or may be i should use if statement as well?
you should just keep the first one.
you should just keep the first one.