6 Replies Latest reply on Sep 9, 2008 11:39 PM by aruvasavi

    How to pass info

    aruvasavi Level 1
      I need to pass information which is going to change in action script of one application(mxml file) to other application(other mxml file)...Kind of inter modular communication...


      Thanks in advance
      Aruna.S.N
        • 1. Re: How to pass info
          EvolvedDSM Level 2
          The only way I've passed info from one application to another is using a data service with a database.

          basically have app #1 insert/update data into a database and then have app #2 pick up the changes via a data service (LCDS/FDS).

          It varies on what you want though. Does the data from app #1 need to be LIVE/REALTIME data in app #2? Or are you just referencing the data via look-up in app #2?
          • 2. Re: How to pass info
            GeorgeWS Level 1
            I have not done it but im sure you could pass the variables:

            public function gotoURL() : void {
            var url:String = " http://www.youngsmarket.com/mynextappswrapper.cfm";
            var variables:URLVariables = new URLVariables();
            variables.Employee = Employee;

            var request:URLRequest = new URLRequest(url);
            request.data = variables;
            try {
            navigateToURL(request, 'Main');
            }
            catch (e:Error) {
            // handle error here
            }
            }

            Have the wrapper recieve the variables and then have the 2nd App take in the variable:

            Employee = Application.application.parameters.Employee;

            Hope this helps

            George
            • 3. Re: How to pass info
              wyattbiker
              I dont know the setup of your app but you could use Flash cookies or sockets.
              • 4. Re: How to pass info
                bitwyse Level 1
                I have seen a number of questions exactly like yours. Recently one of the members here has posted a great url that explains in detail the best way to handle your type of situation.

                http://www.adobe.com/devnet/flex/articles/graduating_pt1.html

                Specifically see Part 2. . . .
                • 5. Re: How to pass info
                  Gregory Lafrance Level 6
                  Please clarify if your are referring to completely separate Flex apps, or simply to mxml or ActionScript components and/or modules that are used in one main Flex app.

                  If you are speaking of mxml or ActionScript components and/or modules that are used in one main Flex app, then access data in the main app via:

                  import mx.core.Application;
                  ...
                  private var myComponentVar:MyVarType = Application.application.myMainAppVar;
                  • 6. How to pass info
                    aruvasavi Level 1
                    To be more clear...
                    <?xml version="1.0" encoding="utf-8"?>
                    <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
                    layout="vertical"
                    verticalAlign="middle"
                    backgroundColor="white">
                    <mx:states>
                    <mx:State name="login">
                    <mx:AddChild>
                    <mx:Form id="loginForm">
                    <mx:FormHeading label="Login" />
                    <mx:FormItem label="Username:">
                    <mx:TextInput id="log_username" />
                    </mx:FormItem>
                    <mx:FormItem label="Password:">
                    <mx:TextInput id="log_password"
                    displayAsPassword="true"/>
                    </mx:FormItem>
                    <mx:RadioButton label="Security" id="SEC" click="check()">
                    </mx:RadioButton>
                    <mx:RadioButton label="Manager" id="MAN" click="check()">
                    </mx:RadioButton>
                    <mx:RadioButton label="IT_staff" id="IT" click="check()" >
                    </mx:RadioButton>
                    <mx:FormItem>
                    <mx:Button label="Login" click="pop()"/>
                    </mx:FormItem>
                    </mx:Form>
                    </mx:AddChild>
                    </mx:State>
                    </mx:states>

                    <mx:Script>
                    <![CDATA[
                    import mx.events.IndexChangedEvent;
                    import mx.events.ItemClickEvent;
                    import mx.managers.PopUpManager;
                    [Bindable]
                    public var Group_ID:int;

                    private function check():void
                    {
                    if(SEC.selected == true)
                    Group_ID = 1;
                    else if(MAN.selected == true)
                    Group_ID = 2;
                    else if(IT.selected == true)
                    Group_ID = 3;
                    }
                    private function pop():void{
                    var t:group = group(PopUpManager.createPopUp(this,group,true));
                    }
                    private function toggleButtonBar_itemClick(evt:ItemClickEvent):void {
                    currentState = evt.item.data;
                    }
                    ]]>
                    </mx:Script>
                    <mx:Array id="dp">
                    <mx:Object data="login" label="Login" />
                    </mx:Array>
                    <mx:ApplicationControlBar dock="true">
                    <mx:ToggleButtonBar id="toggleButtonBar"
                    dataProvider="{dp}"
                    itemClick="toggleButtonBar_itemClick(event);"/>
                    </mx:ApplicationControlBar>
                    </mx:Application>


                    I need to get value of Group_ID in other MXML application and I need to change permissions according to Group_ID...

                    Thanks in Advance
                    Aruna.S.N.