<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>JJohnny pointed me that I could use the handler onCompleted to bind my qml item and my javascript.<br></div>I still have a problem.<br></div>When I run the program, it seems to never reach this handler and displays:<br><br>

<p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(170,0,0)">TypeError: Cannot read property 'myFlow1' of undefined</span></p><p style="margin:0px;text-indent:0px"><br><span style="font-family:'Monospace';font-size:9pt;color:rgb(170,0,0)"></span></p>Undefined should be mySentenceItems<br><br>   sentenceItemComponent.createObject(<br>                                mySentenceItems.myFlow1, {<br>                                    "sentenceSegments": sentenceSegments<br>                                })<br><br></div>and I define it line 59 from <br><a href="https://github.com/allon49/GCompris-qt/blob/master/src/activities/multiple_choices_sentences/multiple_choices_sentences.js">https://github.com/allon49/GCompris-qt/blob/master/src/activities/multiple_choices_sentences/multiple_choices_sentences.js</a><br><br></div><div>and I set it line 42 from<br><a href="https://github.com/allon49/GCompris-qt/blob/master/src/activities/multiple_choices_sentences/SentenceItem.qml">https://github.com/allon49/GCompris-qt/blob/master/src/activities/multiple_choices_sentences/SentenceItem.qml</a><br><br></div><div>But since it does not seem to go up to the onCompleted handler, there must be an additional trick.<br></div><div>It seems that I can not put it in an OnStart handler as there is no start signal attached to a simple item.<br><br></div><div>Any help?<br><br></div><div>Thanks, <br><br></div><div>Emmanuel<br></div><div><br><br><br><br><br><br></div><div><br><br></div><div><div><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-10-24 13:23 GMT+02:00 Emmanuel Charruau <span dir="ltr"><<a href="mailto:echarruau@gmail.com" target="_blank">echarruau@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi everybody,<br><br>I have started a new activity based on babymatch. The activity is a multiple choices activity based on sentences and words.<br>I display a sentence and mutiple choices items for the kid to choose between answers.<br><br>I have done a prototype in qml displaying a sentence in a flow.<br>This sentence is made of different types of words. Words that are plain text (just there to show a normal sentence); words that will be show in color as they will have to be analysed by the user, and finally mutiple choices words.<br></div>That works.<br><div><br>This prototype can be found here: <br><a href="https://github.com/allon49/GCompris-qt/blob/41d6cdae0f036dac0f4f1a0f7fa59b89612def00/src/activities/multiple_choices_sentences/TextItem.qml" target="_blank">https://github.com/allon49/GCompris-qt/blob/41d6cdae0f036dac0f4f1a0f7fa59b89612def00/src/activities/multiple_choices_sentences/TextItem.qml</a>.<br><br>Now I want to implement the same thing using javascript, but I am not able to associate the items components I create to the flow element contained in my element SentenceItem.qml<br><br>I can see how the babyshape author has done this in the main qml file mutiple_choices_sentences.qml using "QtObject { id: items property alias".<br>But I don't see how to apply it to my element SentenceItem.qml as I don't know how to create an equivalent to "items" which is set using onStart: { Activity.start(items, url, levelCount, answerGlow, displayDropCircle) } in multiple_choices_sentences.qml.<br><br>the code can be found here<br><a href="https://github.com/allon49/GCompris-qt/tree/41d6cdae0f036dac0f4f1a0f7fa59b89612def00/src/activities/multiple_choices_sentences" target="_blank">https://github.com/allon49/GCompris-qt/tree/41d6cdae0f036dac0f4f1a0f7fa59b89612def00/src/activities/multiple_choices_sentences</a><br><br>Thanks a lot for you help if you can as I have no idea how to go over this problem.<br><br><br>Regards,<br><br>Emmanuel<br><br><br></div></div>
</blockquote></div><br></div>