关闭窗口并打开一个新窗口钛合金

aqu*_*air 3 javascript xml android titanium titanium-alloy

我需要关闭windows2才能打开windows3.我有下一个代码:我是钛的初学者,请帮助我.

    //Windows1.XML
    <Alloy>
        <Window exitOnClose="false">
            <Button   onClick="openWindows2" visible="false">
            </Button>
        </Window>
    </Alloy>
    CONTROLLER
    //Window1.js
    function openWindows2(e)
    {
      var Window2=Alloy.createController('Window2').getView();
      newWindows.open(); 
    }
    $.Windows1.open()
Run Code Online (Sandbox Code Playgroud)

这段代码是我用windows1 //Window2.XML上的第一个控制器打开的第二个视图

    <Alloy>
        <Window exitOnClose="false">
            <Button   onClick="openWindows3" visible="false">
            </Button>
        </Window>
    </Alloy>
Run Code Online (Sandbox Code Playgroud)

控制器功能打开windows 3 //Window2.js

    function openWindows3(e)
    {
      var Window3=Alloy.createController('Window3').getView();
      newWindows.open(); 
    }
    $.Windows2.open()
Run Code Online (Sandbox Code Playgroud)

我的windows 3 //Window3.XML

    <Alloy>
        <Window exitOnClose="false">
            <Button  onClick="anotherFn" visible="false">
            </Button>
        </Window>
    </Alloy>
    //Window3.js
    $.Windows3.open()
Run Code Online (Sandbox Code Playgroud)

小智 6

您可以用XML定义窗口,例如mycoolwindow.xml.

然后从代码的其他部分:

 var win=Alloy.createController('mycoolwindow').getView();
 win.open();
Run Code Online (Sandbox Code Playgroud)

请参见此处的示例:https://github.com/ricardoalcocer/AlloyOpenWindow

或转到此链接:http://www.youtube.com/watch?v = CB26lUj0UBQ