PDA

View Full Version : List component function


charlosian
11-28-2008, 05:30 PM
ok, so i am trying to use the list component to load videos into the flv player, i have already tested the the video loading code and it works. I'm having trouble with getting the the functions in the list component to execute. in the list component i have label: video1 data: player_mc.load("videoname.flv");

on the main timeline actions i have
event_mc.addEventListener(Event.CHANGE, itemChange)

function itemChange(event:Event):void
{
if(event_mc.selectedItem.label)
{
(event_mc.selectedItem.data);
}
}
i also tried a few other things like getURL but none of them worked.
any help is greatly appreciated.

compsci
11-28-2008, 06:11 PM
What are you trying to do with your if function?
if(event_mc.selectedItem.label)
Should it be something like:
if(event_mc.selectedItem.label=="myLabeName")
This is just a guess, since I am not completly sure whats going wrong.

charlosian
11-28-2008, 07:31 PM
with the function im trying to load a video into the player. i tried what you suggested, but nothing loads at all, i cant see why it wont recognize the function.

compsci
11-28-2008, 08:12 PM
Do you get any errors?

Put a trace() inside the if to see if it gets executed, narrow down the problem. :)

charlosian
11-28-2008, 08:16 PM
ok, i tried the trace statement and it works, i get no errors, so there has to be something wrong with the data part of the list component, i would upload the file but its too big

charlosian
11-28-2008, 08:35 PM
i got it.
event_mc.addEventListener(Event.CHANGE, itemChange)

function itemChange(event:Event):void
{
player_mc.load(event_mc.selectedItem.data);
}

i took the function out of the data parameters of the list component and just put file name of the video.