This is a discussion on "selecting a value from array" within the Flash & Multimedia Forum section. This forum, and the thread "selecting a value from array are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
selecting a value from array
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
selecting a value from array
hi
i ran into some trouble with arrays.. wonder if anyone can guide me? I suppose to load a xml into flash n convert it into an array. After which im suppose to place them in listbox so that ppl are able to select them to view different stuff. Apparently, im unable to get the selected value of the listbox. With this, the users cannot select n the whole thing doesnt work. With array, im suppose to use getSelectedItem to get the value.. but it always ends up in a error "[type function]" [\code] xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("../XMLs/features_index.xml"); ////////////////////////////////////////////////////////////////// function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; image = []; description = []; f_title = []; tawards = []; awards_img = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { f_title[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; image[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue; tawards[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue; awards_img[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue; //trace(awards); } setupFeatureList(); firstImage(); prevImage(); nextImage(); } else { content = "file not loaded!"; } } ////////////////////////////// function nextImage() { if (p<(total-1)) { p++; if (loaded == filesize) { picture._alpha = 100; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; titleText.text = f_title[p]; awards_T.text = tawards[p]; awards.loadMovie(awards_img[p], 50); picture_num(); } } } //////////////////////////// function prevImage() { if (p>0) { p--; picture._alpha = 100; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; titleText.text = f_title[p]; awards_T.text = tawards[p]; awards.loadMovie(awards_img[p], 1); picture_num(); } } //////////////////////////// function firstImage() { if (loaded == filesize) { picture.loadMovie(image[0], 1); desc_txt.text = description[0]; titleText.text = f_title[0]; awards_T.text = tawards[0]; awards.loadMovie(awards_img[0], 1); picture_num(); } } /////////////////////////// function picture_num() { current_pos = p+1; status_txt.text = current_pos+total; } /////////////////////////// function setupFeatureList() { for(var item in f_title){ featureList.addItem(f_title[item]); trace(featureList.getSelectedItem); } } [/code] thanks in advance |
|
|
|
#2
|
|||
|
|||
|
this is a simple mistake - when your write -
trace(featureList.getSelectedItem) Flash will tell you its a function because your not calling the function. Try - featureList.getSelectedItem(); which will call the function to get its return value. Your confusing this method with a property. |
|
#3
|
|||
|
|||
|
oh ok.. i see.. thanks manz..
im quite new to advance AS.. ( ok maybe thats not THAT advance) but im still learning more abt it. About the getting the array datas to be displayed, replacing the current firstImage, how do i go about doing that? i don't have any idea about what i can tell the array to do, in order for the rest of the content to be displayed out upon click of the listbox(to select other content) Thanks in advance |
![]() |
| Tags |
| selecting, value, array |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| no selecting data | franknu | PHP Forum | 4 | May 26th, 2007 18:08 |
| Selecting certain XML elements | fogofogo | Other Programming Languages | 3 | Dec 5th, 2005 12:49 |
| Selecting Numbers | WillisTi | Flash & Multimedia Forum | 1 | Nov 16th, 2005 16:56 |
| Sorting a new array from an existing array | Ozeona | Flash & Multimedia Forum | 2 | Sep 20th, 2005 08:43 |
| array unable to check another array so as to be displayed | Ozeona | Flash & Multimedia Forum | 1 | Aug 5th, 2005 10:26 |