简体   繁体   中英

Fire object's method in titanium List view

Hi guys i am currently developing for IOS 7 with Titanium SDK 3.2.1.GA and i am in need of help.

I can't find anything on how to call an object's method within a list view

Basically i have a list view with a video player in each cell and a play button on top of it, i want the video player to start playing once the user clicks the play button, but i don't know how to fire the video player's play() method from within the list view.

Thank you for your help in advance

If you posted your code it would be easier to help you, but heres the general idea. Just listen on the itemClick event, then fire the play button for that ListItem:

// Keep an array of video players or something like that
var vidPlayersRefs = [...,...,...];

listView.addEventListener('itemclick', function(e){
    // Get the video player for that row  
    var videoPlayer = vidPlayersRefs[e.itemIndex];
    videoPlayer.open();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM