Changing container State from a component

Hi, I try to change the state of an application from a button
inside a mxml component. I found a way for this by handling click
event inside the component and dispatch event to the container (see
the code below). But my problem is that any click is dispatched ! I
would like that only one button dispatch this event, or better :
calling a container's function from the button inside my component
! Is this possible ?
Thanks for your help
Here is a part of the container code :
<?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 function handleCloseEvent(eventObj:Event):void {
currentState='carte';
]]>
</mx:Script>
<mx:states>
<mx:State name="liste">
<mx:AddChild position="lastChild">
<local:liste_vin_region click="handleCloseEvent(event);"
id="fenetre">
</mx:AddChild>
</mx:State>
<mx:State name="carte"/>
</mx:states>
</mx:Canvas>
And the component code :
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
width="514" height="300" xmlns:local="*">
<mx:Metadata>
[Event(name="click", type="flash.events.Event")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import flash.events.Event;
// Redispatch event.
private function
handleCloseEventInternally(eventObj:Event):void {
dispatchEvent(eventObj);
]]>
</mx:Script>
<mx:states>
<mx:State name="liste"/>
</mx:states>
<mx:TitleWindow layout="absolute" left="10" top="10"
bottom="10" right="10" id="titlewindow1"/>
<mx:Button y="14" label="X" right="19" width="29"
click="handleCloseEventInternally(event);" id="button1"/>
</mx:Canvas>

Yes ! That's exactly what I need !
I've tried to do : this._parent like in Flash, but no
result...
Thanks for your help, parentApplication is right for me
!

Similar Messages

  • Is it possible to change application state from a component?

    I was wondering if it is possible to change application state from within a custom component and if so, what would the syntax be if I had an application named "zzz" and I wanted to change the app state from "state1" to "state2" from my component?
    Thanks!

    Hi,
    you always have a static class Application.
    Application.application will be the root component. After that you can change it state.
    Application.application.currentState = "state2";
    But it's not the best way to change states. It's better to dispatch events from components and change states in listeners.

  • How change application´s state from a component´s function

    Hi, I´m doing an Flex application,
    I have created a component "usersRegister", that have next
    function:
    private function comprobacionBBDD():void{
    if(numero>0){
    mensaje="Perfect.\n\n\n Wellcome.";
    HERE I WANT CHANGE THE STATE
    }else if(numero==-1){
    mensaje=mensaje+"error1";
    }else if(numero==-2){
    mensaje=mensaje+"Error2 \n\n";
    Alert.show(mensaje);
    The problem is that when in my application I instances the
    component, I would like to change my application´s state when
    the first "if" from the function is true.
    Can you help me??
    thanks in advance, and excuse my bad english.

    Really thanks. I have try it and works perfectly.

  • 8.1, Change pageflow state from event listener

    Hi,
    I've implemented an event listener in a backing file (like in the custom event
    tutorial ).
    The backing file is assigned to a portlet.
    Is it possible to change the state of the portlets pageflow when an event is received?
    I want to reset the pageflow so that the 'begin' action is executed again.
    From the tutorial and sample portal I found out, that how to change the window
    mode or the visibility, but I can't find any methods for setting the current url/action.
    Another solution would be to setup a listenTo relationship and redirect the incoming
    actions to the 'begin' action. What I'm missing here is the possibility to trigger
    such an event from a page flow (which is possible when using custom events). Can
    this be done?
    Bye
    Achim

    try to go to Control Panel\All Control Panel Items\Administrative Tools
    Disable and set the trigger as never at task scheduler > time sync
    You can also try to clean boot
    http://support.microsoft.com/kb/929135/en-us

  • Call sql statement from JComboBox component

    Hi there,
    I Have created a frame to populate two JComboBoxs, I'm populating the first one from a database using SQL, this datable is showing the category to below every report.
    anybody know how can I select from my first JComboBox a record a call a second SQL statement acutomatic, the idea is populate me second JCombox with data like my first one, remember the first one is a header

    With a JComboBox you have to be careful that you don't run a query when just the cursor is moved up or down the list. If you want the listener to fire just when enter is pressed or the mouse is clicked, then do this:
    //This stops events being fired when the cursor is used on the list
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);You should also attach an event listener like this one:
    comboBox.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt) {
                            executeSomeQuery(comboBox.getSelectedItem().toString());               }
              });Or something similar to above, have a play around with it and it should work how you want it to.
    Message was edited by:
    JStudent911

  • Change button state from another button

    From reading some other posts it would seem that you can only create rectangular button outlines (not buttons but the outlines you drag out in DVDSP to definte your button area).
    Well I have a menu design that has buttons that run at an angle across the page, and they are very close together, so if I use a single rectangular outline it will cover more than one button.
    So, I want to create several small button outlines to cover my button area, but I'd like to have it so that when a button is in a "Selected" state it automatically makes another button "selected" and it is this button that has a overlay highlight that will inidcate what the user is selecting.
    So can a button be moused over and automatically "select" another button.
    (When I say "select" I do NOT mean activated - I don't want to mouseover a button and another button get activated and the user gets taken to the buttons target).
    I also don't want to use a layed PSD file as I don't really like the delay you get.
    I hope this makes sense. If not, I can make some images to show what I mean.
    Thanks in advance

    Sorry Rob - I don't think you'll be able to do that... a DVD button isn't able to be linked to a different button so that it can set it to be selected. The buttons are not that 'intelligent', I'm afraid.
    From what you say you can either use very small buttons with a simple highlight to the side of the text on the back drop, or (sadly) re-do the menu bakground to accommodate the nature of the button rectangles.

  • Change base view state from a custom component

    I'm pretty new to flex and I'm having a small issue in change the view state from a component.
    My Application have 2 custom components called userlogin and main menu. In the main application page I have userlogin component in one state and the main menu component in another. I'm trying to change the state if the login in successful from user login to main menu. I have the following function written inside the login component.
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    This code worked when I had all the controls in the main page. But then I created components and included them in to components and now when the login is success, its giving the following error.
    ArgumentError: Undefined state 'MainMenu'.
        at mx.core::UIComponent/getState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UI Component.as:9908]
        at mx.core::UIComponent/findCommonBaseState()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9928]
        at mx.core::UIComponent/commitCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:9750]
        at mx.core::UIComponent/setCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\ core\UIComponent.as:9701]
        at mx.core::UIComponent/set currentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6087 ]
        at components::UserLoginForm/__btnSubmit_click()[C:\Projects\WarrantyAutomation\src\componen ts\UserLoginForm.mxml:60]
    I'm sure this has something to do with accessing the states from a custom component, but I do not know how to change the state to the main menu. Please help me with this. Any help is greatly appriciated.

    Hi dasun1981,
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    If I am right the above function is in your userlogin component and the two components "userlogincomponent" and "maincomponent" are in main application file and the states were also defined in main application file.
    But in the function above the currentState refers to the state of the userlogin component and not the main application ...but the states are defined in main application file...that's the reason why the exception was thrown...
    Instead you replace the line in the above function with the below line:
    Application.application.currentState = "MainMenu";
    Please mark it as answer if it helped you.
    Thanks,
    Bhasker Chari

  • Changing states from within a component

    Let's say that I have a TileList that is rendering data in a
    VBox. Eventually the TileList fills up and starts scrolling. I want
    to change states when clicking on item in the TileList.
    I don't want to place the click-attribute in the TileList,
    because it will change states when I am scrolling the list without
    actually selecting anything.
    I want to say click="currentState='state2'" inside the VBox,
    but that does not work because state2 is at the root level, and I
    don't know how to get to the root-level (in lack of a better word)
    from withing the component.
    This is not the proper syntax, so misunderstand me the right
    way here... Is there an equivallence to
    click="currentState='_root.state2'" in mxml?
    Thanks for any suggestions or best practices. I want the easy
    way out.
    This is the general structure...
    <mx:Application>
    <mx:states>
    <mx:State id="state1"/>
    <mx:State id="state2"/>
    <mx:State id="state3"/>
    </mx:states>
    <mx:TileList dataprovider="{...}">
    <mx:itemRenderer>
    <mx:component>
    <mx:VBox id="ClickThisBoxToChangeStates">
    <mx:Image/>
    <mx:Label/>
    </mx:Vbox>
    </mx:component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

    Your assumption is right.
    It doesn't work because there is no state2-state defined
    within the mx:component.
    In the documentation about changing states it says that I can
    go from application level and change states within a component;
    like this: click="currentState='mycomponent.anotherstate'" but not
    how I can change a state at application level from within a state.
    When I try, it says (at runtime) that the state is not defined.
    So I don't know why <mx:VBox
    click="currentState='state2'"/> doesn't work.
    I apprechiate your expertese a lot.

  • Change a state in main.mxml from a script in another mxml

    Hi,
    i'm having some trouble with my application, let's say i have the main application file called MAIN.MXML
    in wich i have set different States, and have different forms.
    now i have a form called loginForm which contains the textInput item for Login and Password, i also have a link Need to Register
    which onClick will change the state to show in the same panel a different form registerForm (with the relevant textInput items)
    now the MAIN.MXML includes a custom component called <comp: NetworkManager /> which includes all the logic scripts and MXML
    tags to create and manage an HTTPService request to a PHP Server.
    when the user click on the Login button, this will call a function included in the main.as script (imported in MAIN.MXML) which
    will call a function in the script within NetworkManager.MXML passing all the form data.
    in NetworkManager.MXML the script will create an XML message, will send to the PHP Server and wait the response... if this comes
    true the user is authenticated, otherwise is not.
    so far so good, i get the message sent, the correct response back. Now i want to hide the form in MAIN.MXML and put something like
    Welcome firstName lastName!! instead. But i don't know how to do it. If i try to access the states in MAIN.MXML from the NetworkManager.MXML
    i'll get all sort of errors which i don't have it here with me.
    I know this sounds like a newbie question, and it really is ... any taker?
    your help is much appreciated.
    thanks
    T.

    Hi,
    i've tried RemoveChild but i get an error like:
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()[C:\autobuild\3.2.0\frameworks\p rojects\framework\src\mx\core\UIComponent.as:5096]
    at mx.core::Container/removeChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\ core\Container.as:2274]
    at components::NetworkManager/sendUserAuthHandler()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:182]
    at components::NetworkManager/serverHandler()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:98]
    at components::NetworkManager/__serverRPC_result()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:290]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\framewor ks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:290]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
    at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responde r.as:43]
    at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]
    at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:403]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()
    who is the caller of loginForm then? i've tried with Application.application.loginForm but i do get the same error though.
    loginForm is contained in a Canvas item, is it the caller? or who else?
    thanks
    T.

  • Change state with MenuBar component

    It's pretty easy to change the state with a button. Example:
    click="currentState='AboutScreen'"
    But when I try to do this on the MenuBar component, I'm not
    having any luck. When I click on the item (let's say Help ->
    About), nothing happens. My code is:
    click="currentState='menu.student.create_profile'"
    I also tried,
    itemClick="currentState='menu.student.create_profile'"
    No luck.. anyone know how to change states based off items
    clicked from the MenuBar?

    This should get you started:
    http://www.playingwithfire.com/fun.html

  • Agent cannot change to the requested state from current state

    Hi all,
    I have a new setup using uccx 8 and ccme 8.1 . Everything seems fine exept from randomly agents stuck to a not ready state. When trying to go to a ready state we get the following error "cannot change to the requested state from your current state" . The only option is to log out the agent and then log back in.
    Any ideas?

    Hi there,
    I did the downgrade but no good. After a long search i found what finally the problem is.
    The lines are stuck when there is a trasfer from a non icd dn to an icd dn. Believe it or not this is not supported when the setup uses ccme
    You cannot transfer a call from a common dn to a uccx extension.
    All unsupported features are listed below
    http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/crs/express_8_0/release/notes/uccx_802_rn.pdf
    Thanks for your time.
    Yannis

  • Shrink Log file in log shipping and change the database state from Standby to No recovery mode

    Hello all,
    I have configured sql server 2008 R2 log shipping for some databases and I have two issues:
    can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No
    Truncate" option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge and it will take time to restore in the DR site, so the reconfiguration
    is not an option :( 
    how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need
    to do this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator

    1. can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No Truncate"
    option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge
    and it will take time to restore in the DR site, so the reconfiguration is not an option :( 
    2. how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need to do
    this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator
    1. If you change recovery model of database in logshipping to simple and back to full Logshipping will break and logs wont be resored on Secondary server as log chain will be broken.You can shrink log file of primary database but why would you need that
    what is schedule of log backup. Frequent log backup is already taking care of log files why to shrink it and create performance load on system when log file will ultimately grow and since because instant file initilaization is not for Log files it takes time
    to grow and thus slows performace.
    You said you want to shrink as Database size is huge is it huge or does it have lots of free space. dont worry about data file free space it will eventually be utilized by SQL server when more data comes
    2. You are following wrong method changing state to no recovery would not even allow you to run select queries which you can run in Standby mode. Please refer below link to move Secondary data and log files
    http://www.mssqltips.com/sqlservertip/2836/steps-to-move-sql-server-log-shipping-secondary-database-files/
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • My billing information is correct however iTunes won't accept it. I have tried changing it to "no" card, my statements from the banks are addressed to the same address. What the **** is going on?!

    My billing information is correct however iTunes won't accept it. I have tried changing it to "no" card, my statements from the banks are addressed to the same address. What the **** is going on?!

    Debit cards already in an account seem to keep working, but many people have reported that when entering or updating a card that debit cards are now rejected, and they're not listed in the accepted payment methods.
    As to your issue, only the iTunes Store can help you with this. I understand the irritation, but please note that the U2 free offer is just a single song, not an entire album, so we're only talking about $.99 if you miss out but still want the track. Not a big deal, in my humble opinion.
    Regards.

  • Change the Production state of Software Component in SLD

    Hello,
    I cannot see the list of software component to add in Dev Configuration because the Production State of software component is in Planned state and to appear in the list it should be in Devlopment state.
    How do I change the state. When I login to SLD i dont see the edit mode to change it.
    Thanks
    PS: I did not realize there is separate NWDI forum.  I also asked the same question in Web Dynpro forum.

    Hi,
    if the question is about, why the custom developed software is not visible in "CMS - Landscape Configurator - Track Data tab" when pressing the button "Add SC...", then please answer:
    Did you trigger "Update CMS" after creating the software in SLD? You can do it in the CMS webui - Landscape Config - Domain Data tab.
    Best Regards,
    Ervin (http://wiki.sdn.sap.com/wiki/display/TechTSG/%28NWDI%29Home)

  • I'm trying to buy CC Photoshop/Lightroom packages. In order to complete payment, I need to change the country from the default options (United States) to Brazil, But I'm not allowed to do it. I've already changed my origin country in my account informatio

    I'm trying to buy CC Photoshop/Lightroom packages. In order to complete payment, I need to change the country from the default options (United States) to Brazil, But I'm not allowed to do it. I've already changed my origin country in my account information.How do I change the country in order to complete payment?

    These are the two links I have
    Change/Verify Account https://forums.adobe.com/thread/1465499 may help
    -http://helpx.adobe.com/x-productkb/policy-pricing/change-country-associated-with-adobe-id. html
    If the above doesn't help, you will have to contact Adobe (this is an open forum, not Adobe support)
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

Maybe you are looking for

  • Error ERR-1002 Unable to find item ID for item "ID" in application

    Hi everyone, I'm new to APEX and I've come across this error for the first time. I have a page with a classic report in it, and I want to create a link from one of the columns in the report (ID column) to another page with a classic report in it. So

  • To get data from another user?

    Hi, I am in "scott" user. I need to use the data from another user for example user "sys". i know the database name(i.e.user@database), but i dont know the password of that user. I think by using dblink it is possible. If it is correct then Is there

  • InDesign CS5: Zombie panels

    I've had this problem with CS4 but it seems much more persistent (and annoying) in CS5: Panels that insist on reappearing whenever you switch workspaces, no matter how many times you close them. The panels that appear are library panels and the Sampl

  • Anyone using Kontakt 4 plugin with Mainstage 2? I get frequent crashes from Mainstage while using Kontakt4

    I got a crash while using Maintage and Kontakt... Here is the dump.... Process:         MainStage [1076] Path:            /Applications/MainStage.app/Contents/MacOS/MainStage Identifier:      com.apple.mainstage Version:         2.1.3 (416.81) Build

  • How to edit uir file in full screen?

    Using CVI 8.0.1. I have a large panel. I would like to see the entire panel while editing, however the uir file remains docked in the development environment and I have to use the slide bars. Is there a way to open a file in it's own window for editi