Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-02-2003, 05:30 AM   #1
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default Component Question - listBox

Hi,
I've looked at the new components section and the tutes concerning customizing components, but I cannot fathom what I want to achieve, so I'll explain in the hope that some kindly soul can help me.

I am using a list box to load in a list of vars from a text file for a multiple choice quiz.
When an item is clicked on it is highlighted - so far so good. When a second or subsequent item is clicked it is hiighlighted, and the previous highlight disappears.That is the default action.

How can I adjust the component (or what code can I use)so that each item clicked stays highlighted ?

Cheers

Vosgien

hey, sorry guys I have just realised that this should be posted in the Components forum, I will not repeat(never had a cross post yet) it but hope that a moderator will move it. OK

Last edited by vosgien; 04-02-2003 at 05:55 AM.
vosgien is offline   Reply With Quote
Old 04-02-2003, 10:39 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Um... Will this be the same??? Will it be to know how to select multiple items without Ctrl key??? Or something totally different???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 04-02-2003, 10:50 AM   #3
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi Jason,
How you doing ?
In answer to your questions, the list box loads questions using LoadVars, a user selects as many items as he wants and Score is incremented by one for each item clicked, so, I want each item clicked to remain highlighted, so that he/she can see what they have already clicked on - clear ( probably not - lol!!!)

I have located the correct mc in the library - FSelectableItem - and so far I have managed to alter the code so that when an item is clicked, it's _visibilty is set to false, it will be a useful compromise, but not ideal - any suggestions very much appresciated

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 04-02-2003, 01:50 PM   #4
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

somewhere buried in that list box is a label (in the selected item)...

one way you may be able to do it would be to create a method to change the background color of the label when a list item is selected.


of course cyanblue has a good point there, currently using the cntrl key alows you to select multiple items in the list, so find that code in the component, and modify it so that multiple items can be selected with out using the ctrl key.
__________________
tg
---
what the hell was i thinking?

Last edited by tg; 04-02-2003 at 01:55 PM.
tg is offline   Reply With Quote
Old 04-03-2003, 07:58 AM   #5
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
Well, I have been playing around with this for a while now, I have managed to achieve one or two quite spectacular results, and have gained a better understanding of components and the way they work, although opening the core developer folder is a bit like opening a can worms ( lol!!!)
Next question which doen't involve compenents at all, is, how do I alter the code below to load my .txt file in list format into an ordinary dyanamic text box. Is that possible ?

My txt file looks like this :

&name0=Question1 Page1 Range1&
&name1=Question2 Page1 Range1&
&name2=Question3 Page1 Range1&
&name3=Question4 Page1 Range1&
&name4=Question5 Page1 Range1&
&name5=Question6 Page1 Range1&
etc etc to 40 questions
&numQuestions=40&

and my Loadvars is:

ActionScript Code:
myQuestions1 = new LoadVars(); myQuestions1.onLoad = addQuestions1; myQuestions1.load("Questions1-40.txt"); function addQuestions1() {         for (var i=0; i<this.numQuestions; i++) {          nilForty.addItem(this["name"+i]);          } }

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 04-03-2003, 08:11 AM   #6
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

You just made me hungry...

Anyways... Try this code and see if this does the job for you... BTW, 'nilForty' is the name of the listBox instance, right???
ActionScript Code:
myQuestions1 = new LoadVars(); myQuestions1.onLoad = addQuestions1; myQuestions1.load("Questions1-40.txt"); function addQuestions1() {         for (var i = 0 ; i < Number(myQuestions1.numQuestions) ; i++) {                 nilForty.addItem(myQuestions1["name"+i]);         } }
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 04-03-2003, 08:35 AM   #7
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
yes nilForty is the name of the listBox, BUT I want to load the txt file into an ordinary dynamic text box not a listBox.
That code doesn't do it - think I'll run a trace and try an find out why.
I think, from something I have read here, that I need to alter the txt file, but not sure how

Bon Appetite !

Vosgien
vosgien is offline   Reply With Quote
Old 04-03-2003, 08:44 AM   #8
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Um... Something like this??? Just create a dynamic text field with the instance name of 'qText' on the main timeline and check out the script...
ActionScript Code:
myQuestions1 = new LoadVars(); myQuestions1.onLoad = addQuestions1; myQuestions1.load("Questions1-40.txt"); function addQuestions1() {     for (var i = 0; i < Number(myQuestions1.numQuestions); i++)     {         qText.text += myQuestions1["name" + i] + "\n"; //    nilForty.addItem(myQuestions1["name" + i]);             } }
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 04-03-2003, 08:50 AM   #9
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
yep, great, thanks Jason - think my error was giving the textBox a var name and not an instance name.
Its the little things............

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 04-03-2003, 08:55 AM   #10
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Yup... Usually that's how it is...

Just as a reminder for you... Do not use variable name box in FMX unless you are exporting your movie to F5... That variable name box is there for the backward compatibility, and you are not tasting the sweat juice of FMX with it...

Gotta go get some sleep... See ya...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
My brain hurts (onClipEvent question) andrea_levin ActionScript 2.0 3 03-25-2004 04:23 AM


All times are GMT. The time now is 04:15 PM.

///
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.