Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-15-2005, 05:18 PM   #1
Denexus
Registered User
 
Join Date: Oct 2004
Posts: 45
Arrow Adding text into a dynamic list?

Ok for example I have a button with something like this on it:

on (press) {
text = "Item #1";}

Then I have a dynamic text field, “multiline” which would be the list box that would hold all of these items.

Try to picture that I have a bunch of these buttons each with a different item number and only one list and as each button gets pressed the item # gets added to the list in the order they where clicked.

I hope I made enough sense for someone to help me.
Thanks
Denexus is offline   Reply With Quote
Old 09-15-2005, 05:27 PM   #2
Darkware
Registered User
 
Join Date: Feb 2005
Posts: 139
Default

Windows>Components drag a listbox onto the stage.
give it the instance name "mylist"
make a button
add this AS to said button:
ActionScript Code:
on(release){ mylist.addItem(item1); }
Darkware is offline   Reply With Quote
Old 09-15-2005, 05:35 PM   #3
Denexus
Registered User
 
Join Date: Oct 2004
Posts: 45
Arrow Thanks

Ahh yes I didn’t think about the components. The reason I hesitate to use the flash components is because I’m restricted from editing the appearance. I need to make the list fit my design. I know some components you can change the structure but I don’t think flashes list box is visually editable. If so? Have any suggestions.

What I need is a list that I can have item name + quantity
Like (red shirt |x5)
I built a calculator that loads the amount to a dynamic text box.
and would like these to be posted in the order they are clicked into a list.

And thanks for your help

Last edited by Denexus; 09-15-2005 at 05:41 PM.
Denexus is offline   Reply With Quote
Old 09-15-2005, 05:44 PM   #4
Darkware
Registered User
 
Join Date: Feb 2005
Posts: 139
Default

If you want to edit the appearances of component items, just F11 to bring up the library and go into the Flash UI Components section and wander around headless chicken style. You'll come across what you want methinks.
Darkware is offline   Reply With Quote
Old 09-15-2005, 05:47 PM   #5
Darkware
Registered User
 
Join Date: Feb 2005
Posts: 139
Default

all you have to do is save the calculated output of your calculations to a variable and then name that variable in the button thing. Does that help?
ActionScript Code:
on(release){      mylist.addItem(calculatedOutput); }
Darkware is offline   Reply With Quote
Old 09-15-2005, 05:52 PM   #6
Denexus
Registered User
 
Join Date: Oct 2004
Posts: 45
Arrow

Ok I got a list that is really just a scroll pane called mylistbox

(My button)
on (release) {
MyListBox:NewItem = "green shirt";
call("MyListBox:AddItem");
call("MyListBox:Refresh");
}

Now to add my calculator data to this, what would I add to the code.

By the way thanks for helping me

Last edited by Denexus; 09-15-2005 at 06:14 PM.
Denexus is offline   Reply With Quote
Old 09-15-2005, 06:53 PM   #7
Darkware
Registered User
 
Join Date: Feb 2005
Posts: 139
Default

well, I don't really know what your calculations are o.O' If it's like a number of how many items they selected, you retreive that data when the button is clicked by setting a variable = to whatever item holds the numerical value of how many of whatever item they selected. Say the calculated output was "5" and you had set myVariable = 5 then you would just say
ActionScript Code:
MyListBox:NewItem = "green shirt"+myVariable;
Darkware is offline   Reply With Quote
Old 09-15-2005, 09:44 PM   #8
Denexus
Registered User
 
Join Date: Oct 2004
Posts: 45
Arrow add more

Ok i have everything working now, although just one thing i would like to ask

Items.Add("greenshirt "+sub);
Works fine: but i want to add more although with spaces or text in between the Variables

so somehting like:
Items.Add("greenshirt "+sub,"words"+sub2,"words"+sub3);

example what it looks like when in realtime
sub=1
sub2=2
sub3=3
the result would look like:
Greenshirt 1 words 2 words 3

but it isnt working, I need to learn a bit more of actionscript im more of a editor not a writer.
Denexus is offline   Reply With Quote
Old 09-16-2005, 04:04 AM   #9
Darkware
Registered User
 
Join Date: Feb 2005
Posts: 139
Default

Items.Add("greenshirt "+sub+" words "+sub2+" words "+sub3);

plus signs are your friends
Darkware is offline   Reply With Quote
Old 09-18-2005, 12:03 AM   #10
Denexus
Registered User
 
Join Date: Oct 2004
Posts: 45
Default Works great

works great, thank you so much
Denexus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:56 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.