Hello guys !
I have problem to restart a function defined in the principal view (index.js) from a separated controller. I work with Alloy and Titanium 3.2.2.GA (for Android)
Please let me explain :
The principal view (index.xml) contain the button 'test', with evenement onClick="openLevel"
<Alloy> <Window class="container"> <View id="headerMain"> <Label id="lblScore" class='headerMainLabel' >Score</Label> <Label id="lblNiveau" class='headerMainLabel' >Niveau</Label> </View> <View id="middleMain"> <ImageView id="imgMiddle"></ImageView> </View> <View id="bottomMain"> <Button id="start">START ! </Button> <Button id="test" onClick="openLevel">TEST</Button> <Button id="niveau" onClick="openNiveau">TEST</Button> </View> </Window> </Alloy>I defined the function "openLevel" in index.js like below. Scrol is a scrollableView defined into "test.xml". The page change after x seconds... simple This code is OK.
var Scrol = Alloy.createController('Test') ; function openLevel(e) { // Open the scrolview and change the image Scrol.setPage(0); Scrol.openScrol($.index); Scrol.im00.image = "/mer007.jpg" ; // Change the view after 2 seconds var u = setTimeout(function(e){ Scrol.setPage(1); },2000); };I defined clickable Imageview on the Page 1 of the scrollableView , This Image have evenement "onClick="ClicIm1" (Function ClicIm1 is defined into "test.js")
function ClicIm1(e) { // When user clic here, I want to close the controller "Test" // And restart the function "openLevel" defined in index.js // and also replace the image (Scrol.im00.image = "/mer007.jpg" --> "/mer008.jpg") }My question is : How to do to restart the function "OpenLevel" defined into index.js ?... (We are into "test.js" and the function is into "index.js"). and also change the image into tab 0 ?
Thanks in advance