Solved

Get the value of the createTextField and put it inside loadVariable

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft WSUS 4 90
Video sharing with user login 3 197
YouTube video issue 28 110
Script to Delete registry entry based on Product name 6 155
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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 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.

929 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

10 Experts available now in Live!

Get 1:1 Help Now