Solved

Get the value of the createTextField and put it inside loadVariable

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

749 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