I want to open a widget2 on the touch event of a view , which is placed inside the first widget1. I have tried the following code with no success:
widget1.xml: <TableViewRow height="16mm" backgroundColor="black"> <View left="0" width="15mm" height="100%" backgroundColor="black" > <Label id="flashlightbutton" class="button" icon="fa-lightbulb-o" onTouchstart="startCompass" backgroundColor="black"></Label> <Widget id="fa" src="com.mattmcfarland.fontawesome"/> </View> <View left="15.5mm" height="100%" width="15mm" > <Label id="test2" class="button" icon="fa-pencil-square-o" backgroundColor="black"></Label> <Widget id="fa" src="com.mattmcfarland.fontawesome"/> </View> </TableViewRow>
widget1.js: function startCompass(){ var com=Alloy.createWidget("com.compass"); $.mainwin.add(com.getView()); $.mainwin.open(); };com.compass is my widget2. Can anybody suggest the correct way please!!!!!!