Solved

Get the value of the createTextField and put it inside loadVariable

Posted on 2003-10-29
7
168 Views
Last Modified: 2010-05-18
i have a similar problem with  Matt_Hobbs. i have tried the solution and it works. But i have another problem. I want to get the value of the text field in emptyMovieClip. It always get the last one. i want to put loadVariables in duplicateMovieClip. I assign it as a button, so when user klick one of the button, the value of each text field will send to asp. i didn't call the array because user can change the value of the text field.

//assign depth
depth = -1;
depth5 = 1;

//assign simple array and split it
info = "10,21,3";
sample = "BKR0001,BKR0002,BKR0003";
info_array = info.split(",");
sample_array = sample.split(",");

//assign position
Item_yposition = 0;
additem_yposition = 0;
additem_xposition = 60;

//loop all the things
for (i=0;i<info_array.length;i++) {
//create and duplicate text field
createEmptyMovieClip("prod_mc"+i, depth);
var pm = eval("prod_mc"+i);
pm.createTextField("Item_txt", 1, 160, Item_yposition, 120, 20);
pm.Item_txt.border = true;
pm.Item_txt.type = "input";
pm.Item_txt.text = info_array[i];

//duplicate button inside movieclip that already exist
add_mc.duplicateMovieClip("adds_mc"+i, depth5);
mc = eval("adds_mc"+i);
setProperty(mc,_x, additem_xposition);
setProperty(mc,_y, additem_yposition);
mc.num = i;
mc.txt = nb.Item_txt.text
mc.onRelease = function(i){trace("addbuy.asp?productID=" + mc.txt + "&Quantity=" + apa_array[this.num])};

depth5++;
depth--;
Item_yposition = Item_yposition+30;
additem_yposition = additem_yposition+30;
additem_xposition = additem_xposition+30;
}
stop();


thanks a lot
0
Comment
Question by:R33BOK
  • 3
7 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9648397
well, your code it's quity messy...

• what is "nb.Item_txt.text"? nb does not exist in this code, there's only "pm.Item_txt.text"...
• mc.onRelease = function(i){trace... onRelease does not accept any parameter... mc.onRelease = function(){trace
• ("addbuy.asp?productID=" + mc.txt    there's not any "mc" movieclip inside "mc", and "mc" is a variable name. Use  ("addbuy.asp?productID=" + this.txt
• what is apa_array?

whell, try this code, at least trace the right number, but I don't know if it's what you were looking for

//assign depth
depth = -1;
depth5 = 1;
//assign simple array and split it
info = "10,21,3";
sample = "BKR0001,BKR0002,BKR0003";
info_array = info.split(",");
sample_array = sample.split(",");
//assign position
Item_yposition = 0;
additem_yposition = 0;
additem_xposition = 60;
//loop all the things
for (i = 0; i < info_array.length; i++) {
      //create and duplicate text field
      createEmptyMovieClip("prod_mc" + i, depth);
      var pm = eval("prod_mc" + i);
      pm.createTextField("Item_txt", 1, 160, Item_yposition, 120, 20);
      pm.Item_txt.border = true;
      pm.Item_txt.type = "input";
      pm.Item_txt.text = info_array[i];
      //duplicate button inside movieclip that already exist
      add_mc.duplicateMovieClip("adds_mc" + i, depth5);
      mc = eval("adds_mc" + i);
      setProperty(mc, _x, additem_xposition);
      setProperty(mc, _y, additem_yposition);
      mc.num = i;

      mc.txt = pm.Item_txt.text;

      mc.onRelease = function()
      {
            trace("addbuy.asp?productID=" + this.txt + "&Quantity=" + apa_array[this.num]);
      };
      depth5++;
      depth--;
      Item_yposition = Item_yposition + 30;
      additem_yposition = additem_yposition + 30;
      additem_xposition = additem_xposition + 30;
}
stop();
0
 

Author Comment

by:R33BOK
ID: 9648932
upz.. sorry to make u confuse. i change some of the name and i forgot to test it. Well..it still doesn't work. The value of text fields is already set to the value of the array right. user can change the value of those text field. if the value has changed. the trace should display the new value. change the trace to trace("addbuy.asp?productID=" + sample_array[this.num] + "&Quantity=" + this.txt);
0
 
LVL 27

Accepted Solution

by:
negatyve earned 125 total points
ID: 9648951
0
 

Expert Comment

by:Cyber_Cus2
ID: 9649058
thanks  negatyve!! You save my life and my time;) it woks well now
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9649086
:)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question