如何调用从动作脚本MXML应用程序

如何调用从动作脚本MXML应用程序

本文介绍了如何调用从动作脚本MXML应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有1 main.mxml已登录按钮,它看起来像下面 -

I've one main.mxml which has login button which looks like below -

                     <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            backgroundColor="#C4D4EF" layout="absolute">

         <mx:HTTPService id="serverCall" method="POST"
                url="http://localhost:8080/LDAPService/reg"
                result="on_Result(event)" fault="on_Fault(event)"
                 />
            <mx:Script>
    <![CDATA[
        private function on_Result(event:ResultEvent):void {
        // How to write here
        }

    ]]>
</mx:Script>
<mx:Panel x="414" y="145" width="355" height="200" layout="absolute"
    <mx:Button x="142" y="115" label="Login" id="callToServer"
            click="send_data(event)"/>
</mx:Panel>

</mx:Application>

现在我要打电话second.mxml文件,它看起来像下面 -

Now I want to call second.mxml file which looks like below -

                     <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            xmlns="*" creationComplete="iFrame.visible=true"
                  viewSourceURL="srcview/index.html">

            <mx:HBox width="100%" height="100%">

           <mx:Panel title="/ Company Home" width="200" height="100%" >
                 </mx:Panel>

     <mx:Panel width="100%" height="100%" title="Ticket Details" paddingTop="1" >
        <IFrame id="iFrame" source="some service call url" width="100%" height="100%"  />
        <mx:ControlBar>
            <mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true"
         click="iFrame.visible=cbVisible.selected"/>
        </mx:ControlBar>
         </mx:Panel>

         </mx:HBox>



       </mx:Application>

我怎么能说second.mxml从main.mxml?请指点,谢谢你的帮助!

How can I call second.mxml from main.mxml? Please advice, Thanks for your help!

推荐答案

确定这个例子Flex 4中!它采用MX的火花,而不是这表明国家的基本知识。你可以点击这里阅读: http://www.artima.com/articles/flex_4_states.html本文介绍FLEX3和FLEX4状态之间的差异这仅仅是一个开始。希望这可以帮助你。

OK this example is in flex 4! it uses spark instead of mxThis shows the basics of states.You can read more here: http://www.artima.com/articles/flex_4_states.htmlThis article shows the difference between flex3 and flex4 statesThis is only a start. Hope this helps you.

<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark" >
    <fx:Script ><![CDATA[
        import mx.rpc.events.ResultEvent;

        <![CDATA[
        private function on_Result( event:ResultEvent ):void
        {
            currentState = "result";
        }

            ]]>
        ]]>
    </fx:Script >

    <fx:Declarations >
        <s:HTTPService id="serverCall"
                       url="http://localhost:8080/LDAPService/reg"
                       useProxy="false"
                       method="POST"
                       result="on_Result(event)" >

        </s:HTTPService >
    </fx:Declarations >

    <s:states >
        <s:State name="init" />
        <s:State name="result" />
    </s:states >

    <s:Panel x="414"
             y="145"
             width="355"
             height="200" >
        <s:Button x="142"
                  y="115"
                  label="Login"
                  id="callToServer"
                  includeIn="init"
                  click="serverCall.send()" />
    </s:Panel >

    <s:Panel title="/ Company Home"
             width="200"
             height="100%"
             includeIn="result" >
    </s:Panel >

    <s:Panel width="100%"
             height="100%"
             includeIn="result"
             title="Ticket Details" >

        .... your stuff
    </s:Panel >


</s:Application >

这篇关于如何调用从动作脚本MXML应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!