selecting a value from array

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 27th, 2005, 04:33
Junior Member
Join Date: Jul 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 27th, 2005, 07:25
New Member
Join Date: Jul 2005
Location: Devon
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 27th, 2005, 10:14
Junior Member
Join Date: Jul 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
selecting, value, array

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 23:19.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42