Change a State of main.mxml from a script in a different mxml

Hello

I am having trouble with my application, let's say I have the main application file called HAND. MXML

in which I have defined different States and have different shapes.

now, I have a form called loginForm that contains the element textInput Login and a password, I also have a link to register

What onClick will change the State to display in the Panel even a registerForm of different shape (with items relevant textInput)

now the HAND. MXML includes a custom component called < comp: NetworkManager / > which includes all the scripts of logic and MXML

Tags for creating and managing a HTTPService request on a PHP server.

When the user clicks on the "connect" button, it calls a function included in the main.as script (imported in HAND. MXML) which

calls a function in the script within the NetworkManager.MXML passing all form data.

NetworkManager.MXML the script will create an XML message, will be send to the PHP server, and wait for the response... If it comes

Of course, the user is authenticated, is no different.

well, I get the message, the back of the right answer. Now, I want to hide the MAIN form. MXML and put something like

Welcome firstName lastName. instead. But I don't know how to do it. If I try to access States in HAND. MXML, of the NetworkManager.MXML

I will get all sorts of errors that I have here with me.

I know it sounds like a newbie question, and it's really... all licensee?

your help is very appreciated.

Thank you

T.

Hello

Usually, the best way to do this sort of thing is to work with events. Defining a custom event is necessary which will store different types so that you will always know the nature of the event currently a reshipment. In your main application, simply add an event listener that subscribes to these events (example: this.addEventListener (ChangeEvent.LOGIN_FINISH, onLoginFinish), where "onLoginFinish" will be responsible for changing the status of the main application, and since this event listener is used in the main application, you don't have to worry about scope) and reacted accordingly.

Thus, completion of the registration process you, you could simply send an event (example: dispatchEvent (new ChangeEvent (ChangeEvent.LOGIN_FINISH)) ;) spreads until the event listener that waits for it (since your NetworkManager is a part of the application main mxml, send your event will surely reach the listener), signaling this way a change in the application.)

In case you're new on events then read on Adobe LiveDocs.

Best regards

Barna Biro

PS: subedimadhav would be correct as just that events are much more elegant.

Tags: Flex

Similar Questions

  • Changing the State of the application from a custom component

    Hello, I have several custom components that are included in the original application.

    When I try to change the State of a custom component, I get an error saying "undefined state: name of the State." How can I change the State of the application from a custom component? All States are defined in the original application.

    @linrsvp,.

    If you are using Flex3 try Application.application.currentState = "somestate;

    If you use Flex4 try FlexGlobas.topLevelApplication.currentState = "somestate;

    Don't forget to import the namespaces corresponding to the above.

    Thank you

    Jean Claude

  • When I change the main mxml file in the project and then export the swf file does not change, why?

    I have an existing project, years ago that I need to change, I am using Flash Builder 4. When I export the project, it creates a SWF in bin-release, then when I change the code in the mxml project file or files of any format and export the swf file needs to change, but it's not. You have an idea why this might happen?

    Thank you

    I found the problem, there was a SWF into the html-template folder within the project. This has led to substitute the swf of the new generation.

  • Flex IDE and use main.mxml

    Hi all

    I'm new to Flex ide, so I want to help with the design. I read Essential ActionScript 3.0. from Moock which does not explain the Flex ide, so I know (so far) only the programmatic issues.

    Question 1: Create a new project, Flex creates a main mxml. How can I set up an event here? To know how can I implement the MouseEvent.CLICK from the TextField component (create listeners, adding them in the TextField and so on)?

    Question 2: Suppose I want to implement a graphics class (descending Sprite), where I'll call him later, the time of execution. Can I use the Flex ide to design my class instead of typing all the stuff design by typing the code? I just the visual studio environment, where you can design your container 'View' (they have forms"to the vs) and the IDE vs implements under the hood the source code with the 'new' States, setting up values on properties, and so on. For example, you can open this code (this is a specific file) and change also. So, can I use the Flex ide to design my new graphics classes?

    Question 3: in general, which is the use of the main.mxml that contains design information?

    Take care!

    Dennis

    The way you want it!

    You can create a class that develop your .mxml class.

    You can create objects of this class...

  • Change of State of a component container

    Hi, I try to change the State of a request by a button inside a mxml component. I found a way to do this by managing the event within the event click component and dispatch to the container (see code below). But my problem is that any click is sent! I would like only one button send this event, or better: function call of a container of the button within my component! Is this possible?

    Thanks for your help

    Here is a part of the code of the container:

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Canvas xmlns:mx = ' http://www.adobe.com/2006/mxml " width ="570"height ="360"xmlns:local =" * ">
    < mx:Script >
    <! [CDATA]
    import flash.events.Event;
    public void handleCloseEvent(eventObj:Event):void {}
    currentState = "map";
    }
    []] >
    < / mx:Script >

    < mx: states >
    < name mx: State = 'list' >
    < mx:AddChild position = "lastChild" >
    < local: liste_vin_region click = "handleCloseEvent (event); "id ="window">
    < / mx:AddChild >
    < / mx: State >
    < mx: State name = "map" / >
    < / mx: states >
    < / mx:Canvas >

    And the code of the component:

    "" < mx:Canvas xmlns:mx = ' http://www.adobe.com/2006/mxml " width ="514"height ="300"xmlns:local =" * ">
    < mx:Metadata >
    [Event (name = "click on", type = "flash.events.Event")]
    < / mx:Metadata >

    < mx:Script >
    <! [CDATA]
    import flash.events.Event;
    Forwarding event.
    private void handleCloseEventInternally(eventObj:Event):void {}
    dispatchEvent (eventObj);
    }
    []] >
    < / mx:Script >

    < mx: states >
    < name mx: State = "list" / >
    < / mx: states >
    < mx:TitleWindow layout = "absolute" left = "10" top = "10" low = "10" right = "10" id = "titlewindow1" / >
    < mx:Button = "14" label = "X" right = "19" width = "29" click = "handleCloseEventInternally (event); "id ="button1"/ >
    < / mx:Canvas >

    From within the component, you can all a method in the application that contains, with:
    parentApplication.methodName ();

  • Adobe Muse doesn't let me change the States of thumbnails in a lightbox.

    Muse doesn't let me change the States of thumbnails for my lightbox. The only thing that it is allowing me to do the right now is to change the opacity of each State. I would like to than the 'normal' State of my nail of the thumb to be a solid color, the "Rollover" State to reveal the image that is displayed in the Viewer, the State of "mouse down" to be another solid color and the 'active' State of being of the same color together as a 'normal' State I changed the color, and I even tried to fill it with a real image with a solid color file. Nothing will work - the State remains just to display the main images in the thumbnails. I would appreciate help! I don't understand why it won't work. States work for everything else.

    Hello

    With startup, if you add a picture as a thumbnail then it could appear as hero image.

    We cannot install according to States with the thumbnails of the images, any image or fill added to the would be added as a background image. You can change the image of the active panel, but still we can not install different images with the States.

    Better idea would be to use the composition where you can set up reports for the triggers and the images separate targets.

    Thank you

    Sanjit

  • Move the Main.mxml Variable to Pop.mxml

    Hi all.

    I have a project that has two files.

    Main.MXML and Pop.mxml

    Main.MXML is obv my main application and it has a variable that contains the link to an image.  This variable changes on a regular basis.

    The Pop.mxml file is a TitleWindow I want to display the image, but on a larger scale.

    My Pop.mxml code is like:

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:TitleWindow ' http://www.Adobe.com/2006/MXML "
    Layout = "vertical".
    title = "Tazio audio"
    showCloseButton = "true".
    width = "1022".
    height = "800".
    Close = "titleWindow_close (Event); "move =" doMove (event) ">

    < mx:Script >
    <! [CDATA]
    Import mx.events.CloseEvent;
    Import mx.managers.PopUpManager;
    Import mx.core.Application;

    [Bindable] public var test: String;

    private void titleWindow_close(evt:CloseEvent):void {}
    PopUpManager.removePopUp (this);
    }
    private void doMove(event:Event):void
    {//keeps TW inside the layout
    var appW:Number = Application.application.width;
    var appH:Number = Application.application.height;
    if(this.x+This.Width>appW)
    {
    This.x = appW - this.width;
    }
    if(this.x<0)
    {
    This.x = 0;
    }
    if(this.y+This.Height>appH)
    {
    This.y = appH - this.height;
    }
    if(this.y<0)
    {
    This.y = 0;
    }
    }


    []] >
    < / mx:Script >
    < mx:SWFLoader width = '100 percent"height ="100% "source="swf/slide1.swf"/ >
    < mx:Label text = "{test}" color = "#C00D0D" x = "1200" top = "20" / >

    < / mx:TitleWindow >

    What I'm struggling with you, is how to pass the Main.mxml variable to Pop.mxml.

    I know how to do this with components, its easy enough, but I see no to make between these two files.

    The vairable I am rying to spend at the momnet is called 'test'.

    Any help would be great, thanks!

    Hello

    How you launch the popup, if you use PopupManager, try this

    var popup:Pop = Pop(PopUpManager.createPopUp(this, Pop, true));
    popup.test = "your value";
    PopUpManager.centerPopUp(popup);
    
  • How to access the main .mxml file component control?

    I have a .mxml main while in which I imported custom "popUpWindow" component using the statement "import components.popUpWindow". In main .mxml file, I show more later this component in the form of pop-up window using the Popup Manager class:

    var popUpWin:IFlexDisplayObject;
    popUpWin = PopUpManager.createPopUp (Thi, popUpWindow, true);

    Once the component is displayed, how can I access using the actionscript component TextInput control (specifically the .text property) my main .mxml file?

    Thank you

    bdeen I think you have it bad: P I think he wants to access a property in the main application window.

    Give the textInput id and then on your main application you can do this for example:

    var test: String = popUpWin.textInputName.text;

    Please note that it is recommended to do a casting for the popup window:
    popUpWin = popUpWindow (PopUpManager.createPopUp (Thi, popUpWindow, true));

  • change a State of buttons based on another value of buttons

    do not remember how to change a State of buttons depending on the value of another button.

    I think it was a structure of the event?

    can someone point out an example?

    Thank you

    There are several elements to your question:

    In response to a status change button: this can be done with either a structure of the event in a loop, or by querying the button in the loop. Examples are provided with LabVIEW on the use of the structures of the event.

    Changing the value of another button: this can be done with either a local variable or a "Value" property node (Cue the crowd of local variables at this stage.). Note that the lock of your button action will affect if you can do it. See this article for more information: why is my property a Boolean node a Variant?

  • How can I change the time on my computer from 24 hour to 12 hour clock clock?

    How can I change the time on my computer from 24 hour to 12 hour clock clock?

    How can I change the time on my computer from 24 hour to 12 hour clock clock?

    Here is the method for Windows 7. If you are using Vista, there may be a slight difference, but basic procedures should be similar...

    Start > Control Panel > region and language > Format > more settings > time tab >

    under time format, set hh: mm hh: mm

    H = 24 hours

    h = 12 hours

    Click OK when finished.

  • How to change the recovery of main mobile phone account is linked to a mobile phone that is no longer in use

    Using Hotmail, how to change the recovery of main mobile phone account is linked to a mobile phone that is no longer in use.

    I can't remove it, I can't change it or do anything else without the system you want to send a text message for that phone for conformation. can you change the setting to send an email to the place or the main number of conformation ahange.

    Steve

    Hello

    The question you have posted is related to hotmail; This is why it would be better suited in the Windows Live community. Please visit the link below to find a community that will provide the best support.

    http://www.windowslivehelp.com/product.aspx?ProductID=1

    http://www.windowslivehelp.com/

  • change of State and change read Boolean

    Hello everyone,

    Sorry to bother you, but as a new user of Labview, I always have problems to the VI program. I try to do my best alone, but right now I'm at an impasse for some time... That's why I come back to you.

    Here's my problem:

    -in A VI I made, I have a Boolean value which controls than if the data are recorded or not. When recording is activated, the led lights up, when off the light is.

    -Actually, I bind the Save action to something more complicated:, I wish that the State changing the Boolean value to light several leds in a specific order.

    Thus, when the Boolean value changes, this should change the status of the leds.

    I managed to do it, when you press the button in the boolean_count.VI, which has for result that I would get.

    My problem is that the state change is not triggered by a push button. It depends on several State (true or false), which the record command or not.

    To simulate this, I tried to do the same as above, but with 2 Boolean values, which must be both faithful to initiate a change. I tried to do this in the Try_out_boolean.VI file

    But iin this file, when I push my buttons, there is no change of State in the right part of my Panel of...

    I hope you can underrstand what I mean. If you have any suggestions, I'll be happy to read them.

    in the property node "1and2" of your Try_out_boolean.vi, you read the property "BindingLEDVisible".

    (as I downloaded) That makes no sense at all.

    -> Click on with the mouse on the node of this property one choosing the property "Value" instead.

    Then, your application must react as wanted.

    Thre may be other possible improvements, for example using the event structures instead of constantly of the poll.

    but that's another topic...

    I hope that this help a little.

  • How can I change Microsoft Lifecam VX 800 frequency from 60 Hz to 50 HZ to avoid flickering?

    Original title: Microsoft lifecam VX 800 frequency

    How can I change Microsoft lifecam VX 800 frequency from 60 Hz to 50 HZ to avoid flickering

    Hello

    I recommend contacting Microsoft hardware supports assistance.


    Reference:
    Troubleshooting

    Hope the helps of information.

  • Change the State of all the Image inside the list view toggle button when a list is tap

    Hi, please help, is there a way to change the State of a toggle button to image inside the listview where in when you type a list, the toggle button in the list state change and the other toggle button will be set to their default image? the list has a defined Image toggle button to check both...

    
    ListView {
    
                        layout: GridListLayout {
                            cellAspectRatio: 1.4
                        }
    
                        id: denominationList
                        dataModel: _model.denominationModel
    
                        listItemComponents: [
    
                            ListItemComponent {
    
                                id: component
                                type: "item"
                                CustomListItem {
    
                                    id: itemRoot
                                    dividerVisible: false
                                    highlightAppearance: HighlightAppearance.None
    
                                    Container {
                                        id: fieldContainer
                                        topPadding: 5
                                        leftPadding: 10
                                        rightPadding: 10
                                        bottomPadding: 5
                                        //maxWidth: 270
    
                                        layout: DockLayout {}
    
                                        Container {
                                            id: amountContainer
                                            //topPadding: 
    
                                            layout: DockLayout {}
                                            background: Color.create("#ffffff")
                                            horizontalAlignment: HorizontalAlignment.Center
                                            verticalAlignment: VerticalAlignment.Center
    
                                            ImageView {
                                                id: amountBorder
                                                preferredWidth: 400
                                                imageSource: "asset:///images/flux/amount-border-other.png"
                                            }
    
                                            Container {
                                                horizontalAlignment: HorizontalAlignment.Center
                                                verticalAlignment: VerticalAlignment.Center
                                                layout: StackLayout {
                                                    orientation: (!(ListItemData.name > 4) ? LayoutOrientation.TopToBottom : LayoutOrientation.LeftToRight)
                                                }
    
                                                Container {
                                                    horizontalAlignment: HorizontalAlignment.Center
                                                    verticalAlignment: VerticalAlignment.Top
                                                    visible: (ListItemData.name.length > 4)
    
                                                    preferredHeight: 60
    
                                                    Label {
                                                        id: loadPromoName
                                                        textFit.mode: LabelTextFitMode.FitToBounds
                                                        //multiline: true
                                                        visible: (ListItemData.name.length > 4)
    
                                                        textStyle{
                                                            fontSize: FontSize.Medium
                                                            fontWeight: FontWeight.W300
                                                            color: Color.create("#b9babe")
                                                            textAlign: TextAlign.Center
                                                        }
    
                                                        text: ListItemData.name
                                                    }
                                                }
    
                                                Container {
                                                    verticalAlignment: VerticalAlignment.Center
                                                    topPadding: 8
                                                    rightPadding: 0
                                                    ImageView {
                                                        visible: (ListItemData.name.length <= 4)
                                                        preferredHeight: 40
                                                        imageSource: "asset:///images/flux/pesosign-amount.png"
                                                    }
                                                }
    
                                                Container {
                                                    verticalAlignment: ((ListItemData.name.length > 4) ? VerticalAlignment.Center : VerticalAlignment.Bottom)
                                                    horizontalAlignment: HorizontalAlignment.Center
                                                    leftPadding: 0
    
                                                    Label {
                                                        id: amountLabel
                                                        textFit.mode: LabelTextFitMode.FitToBounds
    
                                                        textStyle{
                                                            fontSize: FontSize.XLarge
                                                            fontWeight: FontWeight.W300
                                                            color: Color.create("#b9babe")
                                                            textAlign: TextAlign.Center
                                                        }
    
                                                        text: ListItemData.amount
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        ]
                        onTriggered: {
                            var selectedItem = dataModel.data(indexPath);
    
                        }
                    }
                }
    

    link the button to a property of an element, and then change all the elements in the datamodel. ListView reflects these changes.

  • Change your state of global hot spare on loan

    Question 1: I have a reference dell power edge 2950 with perc 6 / i integrated. I have four 450 GB RAID 5 drives, a disk as a global hot spare, and a disk without operating with State loans. Can I change the State of this hot spare to prepare so I can add another raid 1 logic with two 450 GB drives? Should what steps I take?

    Question 2: Physical disk 0:0:1 is damaged and I need to replace it. As I said I have a disk without exploitation, disc 1:0:5. Can I remove the drive without exploitation and replace the damaged one(0:0:1); remove the disc at the same time two will damage the server?

    1. Yes. You must delete the assignment the rescue. This is done either on the display of physical disks (World Relief) or virtual disks (dedicated relief).

    2. remove both drives at the same time will not damage the server. This will damage your table if you remove two ACTIVE RAID 5 with disks, but not a relief. Remove the drive bad "to hot' (do not feed out to replace), and then insert the disc before doing nothing).

Maybe you are looking for

  • OSX EL CAPITAN UPDATE CANNOT BE INSTALLED TO THIS DISK. THIS VOLUME DOES NOT MEET THE CONDITIONS FOR THIS UPDATE

    Hi all My iMac features are: 27-inch, late 2013 3.2 GHz Intel Core i5 processor 8 GB 1600 MHz DDR3 memory Start drive Macintosh HD NVIDIA GeForce GT 1024Mo of 755M graphics Storage: 301,35 free GB of 999,35 GB Running currently on OS X El Capitan wit

  • Where is my Windows Installer?

    I'm trying to re-download Adobe 9.4.  (I really hate Adobe X).  The download comes to halfway and I get an error message saying that Windows Installer is not found, check if I'm in Mode safe or there are errors in the installation program.  I've chec

  • Benefits of the EC 5.3 5.4

    I inherited a single instance of ACS, version 5.3, running server in a virtual machine.  I would like to add one or two more for redundancy, but before plans to do so, upgrade to 5.4 I see a lot of documents explaining the characteristics at the poin

  • Edit the IPTC Extension script Photoshop metadata

    HelloI use a droplet which based on a script will rename my pictures.I want to retain the original name of the file in the metadata of Image ID of the provider if possible.Can I do that only in Photoshop without using the bridge?I tried to do a numbe

  • The affected BONES after vMotion

    After having successfully migrated a virtual machine (host Exchange) the guest operating system is slow to respond to the point where the virtual machine must be reset and services get has stopped on the guest operating system.  Restart the guest ope