Listpicker App Inventor的问题

时间:2015-05-04 00:34:13

标签: android app-inventor

我是App Inventor的初学者,我不知道自己在function return1() { return Promise.resolve(1); } function wait(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } function increment(val) { return wait(1000).then(function () { return val + 1; }); } function square(val) { return wait(1000).then(function () { return val * val; }); } var p = return1() .then(increment) .then(square); // Returns a promise that will resolve to 4 (eventually) p.then(function (result) { console.log(result); }); 做错了什么。 我正在尝试创建和应用以重现我存储在服务器中的音乐但是当我显示listpicker时,我无法点击任何选项,而且我无法返回到第一个屏幕。在这里,我把我的代码:

图片1 enter image description here 图2 enter image description here

我尝试删除显示listpicker的行,但它只显示为全黑屏幕。 我刚刚发布的代码的结果正是我所看到的列表,其中包含我已经上传到服务器的2首歌曲的名称和链接,但是当我点击它们时它没有做任何事情。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

Web组件异步工作,这意味着需要一点点,直到结果可用。您将在Web.GotText事件中获得结果。

因此,在updateListpicker事件中调用Listpicker.BeforePicking过程没有意义,因为结果仍然不可用,并且您会显示一个空的listpicker。在收到结果之前,将打开listpicker!

将listpicker设置为visible = false,并使用button.click事件调用updateListpicker过程。然后,您已在Web.GotText事件中执行此操作,请分配收到的列表到listpicker并打开它。