Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Bad timing with button.fireEvent

$
0
0

Hi,

my app does something like that

while (i < 10){
    button[i] = Ti.UI.createButton({
        //Some parameters
    });
 
    button[i].addEventListener('click', function(){
        //do something
    });
Got 2 tabs in this problem : tab "presentation" (tab1) , and tab "search" (tab2)

In fact, when I click on a button, it reloads me the buttons with new parameters, in a new view. And I have a search function, when it founds the button I need, it does some fireEvent. For example

View n°0 : -button1 -button2 -button3

When I click button2, it creates view[2], on which are created : -button20 -button21 -button22 Next, click on button22 creates view[20] on which are created : -button221 -button225

If I search "button22" in my search tab, it shows a button named "button22", and when I click on this button, it switches from tab2 to tab1, fire the event click on button 2, then on button 22 to show what is under button 22.

This works PERFECTLY on Android. But on iOs, it releases " 'undefined' is not an object (evaluating 'button[i].fireEvent') a app.js (line 1)"

I think that iOs wants to add the eventListener BEFORE doing anything else (like creating the buttons...)

Any solution to that, or some begin of help ?

Thank you

If needed, I can copy-paste my full search & display code that works on Android


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>