Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-27-2006, 04:26 PM   #1
Senior Member
Join Date: Feb 2006
Posts: 132
Default Question about using list component


I've actually never used components before so having a little trouble figuring out how to do this, although I would think it would be simple?

Basically there is a list component that holds a list of gallery names.
The list component display a list of gallery names, gallery1 - gallery7
The only thing I need to figure out is that I want to call a function whenever each list item is clicked. Just don't know how...

Thanks for any help

// The following example discovers the number of visible items in a list:
var rowCount = my_list.rowCount;

// The following example removes a partial row at the bottom of a list, if there is one:
my_list.rowCount = my_list.rowCount;

// The following example resizes the list using the setSize() method and then sets a row count of 8 items:
my_list.addItem({data:"gallery1", label:"gallery1"});
my_list.addItem({data:"gallery2", label:"gallery2"});
my_list.addItem({data:"gallery3", label:"gallery3"});
my_list.addItem({data:"gallery4", label:"gallery4"});
my_list.addItem({data:"gallery5", label:"gallery5"});
my_list.addItem({data:"gallery6", label:"gallery6"});
my_list.addItem({data:"gallery7", label:"gallery7"});

my_list.setSize(130, 30);
my_list.rowCount = 7;
my_list.hScrollPolicy = "off";
trace("my_list has " + my_list.rowCount + " rows.");

// set the row height
my_list.rowHeight = 20;

// custom look 'n' feel...
my_list.backgroundColor = "0x2c2c2c";
my_list.borderStyle = "none";
my_list.color = "0x94CE00";
my_list.embedFonts = "true";
my_list.fontFamily = "FFF Star";
my_list.fontWeight = "normal";
my_list.fontSize = "8";
my_list.textRollOverColor = "0x777777";
my_list.textSelectedColor = "0x898888";
my_list.rollOverColor = "0x2c2c2c";
my_list.selectionColor = "0x2c2c2c";
typografuk is offline   Reply With Quote
Old 12-27-2006, 05:56 PM   #2
Senior Member
Join Date: Feb 2006
Posts: 132

ok, moved to components, thankyou, i just figured since it was being controlled via actionscript...

anyway here's the answer for anyone else that needs to do this...
var listHandler:Object = new Object();
listHandler.change = function(evt:Object) {
switch (evt.target.selectedItem.data) {
case "gallery1" :
trace("1"); break;
case "gallery2" :
trace("2"); break;
case "gallery3" :
trace("3"); break;
default :
trace("unhandled event: "+evt.target.selectedItem.data);

my_list.addEventListener("change", listHandler);
typografuk is offline   Reply With Quote
Old 12-27-2006, 06:13 PM   #3
Join Date: Jun 2001
Location: portland, or
Posts: 8,106

should be able to do it this way too:
ActionScript Code:
var listHandler:Object = new Object(); listHandler.change = function(evt:Object) { _root.ssp.loadAlbum(evt.target.selectedItem.label); } }; my_list.addEventListener("change", listHandler);
what the hell was i thinking?
tg is offline   Reply With Quote

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
List component, drag item mwmitchell Components 1 06-13-2006 05:19 PM
List component linking jyelrow Components 2 04-08-2006 05:04 PM
2 Part Question: Tooltips for List Component . Word Wrap for List Component FaceEraser Components 0 09-12-2005 01:13 PM
How to change parameter args list in Component Inspector panel automatically legolas1016 ActionScript 2.0 0 12-24-2004 12:07 AM
logic, loadMovie using dragablePane component question tankthesaga ActionScript 1.0 (and below) 3 04-15-2004 07:34 PM

All times are GMT. The time now is 04:35 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.