Solved

Get the value of the createTextField and put it inside loadVariable

Posted on 2003-10-29
7
162 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now