Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Problem with ListBox component


Atmosfera
6/24/2004 9:53:05 PM
hi there, just a doubt, I've a ListBox with this AS in the same frame:

// create items
var item1 = {label:"Este es un tipo de ejemplo"};
var item2 = {label:"este podria ser otro"};
var item3 = {label:"como para no dejarlo afuera"};
var item4 = {label:"y ahora que te puedo decir"};
// load items
myListBox.addItem(item1);
myListBox.addItem(item2);
myListBox.addItem(item3);
myListBox.addItem(item4);

what I want to do is when the user clicks into each item listed in the
listbox, send the action to open an external .HTML document, but I don't know
how to do this, anybody can help me please?, thanks

Arturo

silkpuppet
6/24/2004 10:11:15 PM
In the code below, the data field is the URL:



function change(evt:Object):Void {
var address = evt.target.selectedItem.data;
getURL(address);
}

// create items
var item1 = {label:"Este es un tipo de ejemplo", data:"http://google.com"};
var item2 = {label:"este podria ser otro", data:"http://yahoo.com"};
var item3 = {label:"como para no dejarlo afuera",
data:"http://somewhereElse.com"};
var item4 = {label:"y ahora que te puedo decir",
data:"http://yetAnotherPlace.com"};

// load items
myListBox.addItem(item1);
myListBox.addItem(item2);
myListBox.addItem(item3);
myListBox.addItem(item4);

myListBox.addEventListener("change", this);
Atmosfera
6/24/2004 10:13:57 PM
thanks silkpuppet


now it's working!!!

now I've another doubt, when you roll over the mouse there's a green color in
each item, do you know how I can change this color?

and again, thanks a lot!!

Arturo
silkpuppet
6/24/2004 10:17:19 PM

myListBox.setStyle("selectionColor", 0xD6E6F8);
myListBox.setStyle("rollOverColor", 0xCAD2D9);
Atmosfera
6/24/2004 10:20:26 PM
Atmosfera
6/24/2004 11:07:23 PM
thanks, now it's just a simple question, I just changed the rollover color, but
the component do not match with the background color of my movie clip, is there
any way to change the color of the component, the text color / font and the
scroll color?

thanks a lot!
silkpuppet
6/24/2004 11:10:43 PM
AddThis Social Bookmark Button