?
Solved

Get the value of the createTextField and put it inside loadVariable

Posted on 2003-10-29
7
Medium Priority
?
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

649 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