How to run functions when changing states?

Hi everybody
I want to run function when changin states
For example I change my state and write something on Panels title and when this state appears i want to read my title and to do smth
How can I do it. Where is my mistake?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="middle"
    width="340" height="250"
    layout="absolute"
currentStateChange="StateChangez();">
<mx:Script>
<![CDATA[
public function StateChangez():void
if (currentState=='a')
//Alert.show('a');
if (Panel1.title=='New')
Alert.show('New');
else
Alert.show('Edit');
else
Alert.show('b');
]]>
</mx:Script>
<mx:states>
  <mx:State name="a">
   <mx:RemoveChild target="{button1}"/>
   <mx:RemoveChild target="{button2}"/>
   <mx:AddChild position="lastChild">
    <mx:Panel x="0" y="40" width="340" height="210" layout="absolute" id="Panel1">
    </mx:Panel>
   </mx:AddChild>
   <mx:RemoveChild target="{button3}"/>
  </mx:State>
  <mx:State name="b">
   <mx:RemoveChild target="{button2}"/>
   <mx:RemoveChild target="{button1}"/>
   <mx:RemoveChild target="{button3}"/>
   <mx:AddChild position="lastChild">
    <mx:Label x="10" y="222" text="b"/>
   </mx:AddChild>
  </mx:State>
</mx:states>
<mx:Script>
  <![CDATA[
   import mx.controls.Alert;
  ]]>
</mx:Script>
<mx:Button label="New" x="10" y="10" id="button1" click="currentState='a';Panel1.title='New';"/>
<mx:Button x="68" y="10" label="Edit" id="button2" click="currentState='a';Panel1.title='Edit';"/>
<mx:Button x="10" y="218" label="b" click="currentState='b';" id="button3"/>
<mx:Button x="265" y="10" label="Read" click="StateChangez()"/>
</mx:Application> 
Message was edited by: AtomicRussian

Hi,
I think your event handler "StageChangez()" is called before your Panel title is set. Try first change title, then change currentState.
Oh yes my mistake, you are adding it when state changes. You can put your Panel's title change in StageChangez() and after that you can do some actions.
Regards,
Adrian
Message was edited by: AdrianWiecek

Similar Messages

  • Run function when hit enter

    Hi Guys,
       According to the "How To…Run Planning Sequences on Save and other events (WEB)" paper we can run functions when click save button or open the layout. Anybody know how to  make the function run when the user hit enter key. We had done this at my previous clint, but forget the detail.
    Thanks

    Hi JW,
    To run functions on save, do the following:
    1. define your planning function or planning sequence (which is a Function Pushbutton) in the web interface builder,
    2. On the Planning Layout, equate "Function After Data Change" to the planning function defined above.
    Trust this is what you are looking for.
    Cheers,
    FM.

  • How to run function(s) on ANY program exit?

    I can easily do this when someone selects "Exit" from the program's menu, with this code:
    AllSortsOfExitCode()
    System.out.println("Ok, everything is wrapped up. Now we will end the program.");
    System.exit(0);
    BUT...how do you get this code to run when someone clicks the little X in the upper-right hand corner?
    I can't figure out how to do that.
    I need to override the class destructor or something, but I don't think Java has destructors in the classic sense. I found one 4-page thread about "Java destructors" but it was just an argument between a couple people -- I didn't learn anything from it.
    Thanks,
    Matthew

    CathInfo wrote:
    BUT...how do you get this code to run when someone clicks the little X in the upper-right hand corner?
    Thanks,
    MatthewThe earlier replies cover the case you described above. But your thread title says something else:
    How to run function(s) on ANY program exit?Answer - you can't. Power loss can't be handled. Shutdoen hooks can help with most other conditions, see
    http://www.google.com/search?num=100&hl=en&c2coff=1&q=java+shutdown+hook&btnG=Search

  • Run function when open layout

    Hi,
       I need to run a function when open a layout, I follow the "How to Run Planning Sequences on Save and Other Events" paper, but fail.
       After get into debug, I notice that in the following code
    IF lr_lay->is_ready_for( cl_upwb_bsp_appl=>ce_get_data ) = cb_true.
          CONCATENATE l_id '_before' INTO l_id_seq.
    ENDIF.
    The if statement is not satisfy, therefore "CONCATENATE l_id '_before' INTO l_id_seq." statement never executed.
    Anybody know how to fix it?
    Thanks!

    I understand is that when open the layout, the function should run according to the how to paper, but it not run.in debug, I find out that "IF lr_lay->is_ready_for( cl_upwb_bsp_appl=>ce_get_data ) = cb_true."
    is false, therefore,the statement "CONCATENATE l_id '_before' INTO l_id_seq." is not run, therefore,the function is not run. However  since the code is standard from the how to paper, I can not find the reason.

  • How to Run Function Modules.

    Hi folks.
    How do you run function modules?
    e.g.
    The function module
    RSBB_URL_PREFIX_GET will show information on URL prefix, path and server name in order to configure for web reports.
    I am trying to figure out  how to carry out the task step by step on BW system.
    Thank you.
    Kara.

    Hi:
    Test run in BW -
    go to transaction SE37
    RSBB_URL_PREFIX_GET
    give this info when you hit Test/Execute
    Handler class: CL_RSR_WWW_HTTP
    Protocal:
    Message Server: X
    Hit execute again.
    Chamarthy

  • How to run a single sql statement

    I want to run a simple sql statement to get some data in my Controller or AM.
    Is there some way, other than creating a VO with the SQL statement, to get some data from the database. My sql query will always return a single row.

    Hi,
    here you have an example I use to call a function in a package (note how you can pass parameters and read results):
    Connection conn = this.getOADBTransaction().getJdbcConnection();
    OracleCallableStatement ocs = null;
    String param = null;
    try {
            String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
            ocs = (OracleCallableStatement)conn.prepareCall(stmt);
            ocs.registerOutParameter(1, OracleTypes.CHAR);
            ocs.setString(2, <param>);
            ocs.execute();
            param = ocs.getString(1);
         } catch(SQLException se) {
             throw OAException.wrapperException(se);
         finally {
             try {
                    ocs.close();
                    return(param);
             } catch(Exception e) {
                    throw OAException.wrapperException(e);
         }Hope this helps you
    Bye
    Raffy

  • How to get notified when changes happen on Hyper-V host or VMs

    Is there a way to get notified on Hyper-V host or VM changes? Our intention is to notify the system-administrators on any changes.
    1. How to get notified when new VM is created (or deleted) on Hyper-V.
    2. How to get notified when any memory/CPU/disk is added (or deleted) on any VM(s).
    In general: 
    - Get notified when any changes happens to Hyper-V host.
    - Get notified when any changes happens on any VMs.
    Our target servers are Windows Server(2008, 2008 R2, 2012, and 2012 R2)
    We tried to get the notification using "Event Viewer" on different Windows servers (2008, 2008 R2, 2012, and 2012 R2)
    We were able to get event-logs only on one of our 2012 R2 server as described below on creation/deletion of VMs (on another 2012 R2 server, we did not got any such event, Is there any setting required on host computer to get Hyper-V event-logs in "Event
    Viewer"?)
    Log Name:      Microsoft-Windows-Hyper-V-VMMS-Admin
    Source:        Microsoft-Windows-Hyper-V-VMMS
    Date:          12/18/2014 1:21:45 AM
    Event ID:      13002
    Task Category: None
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      HPHyper-V.COMPUTERNAME.lab
    Description:
    A new virtual machine 'TestVM' was created. (Virtual machine ID A0FED305-7B1A-4BB5-952C-BA9634ACDA45)
    Log Name:      Microsoft-Windows-Hyper-V-VMMS-Admin
    Source:        Microsoft-Windows-Hyper-V-VMMS
    Date:          12/17/2014 10:57:01 PM
    Event ID:      13003
    Task Category: None
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      HPHyper-V.COMPUTERNAME.lab
    Description: The virtual machine 'TestVM' was deleted. (Virtual machine ID A0FED305-7B1A-4BB5-952C-BA9634ACDA45)

    Thanks for your reply,
    Just to make it more clear:
    In our environment we have enabled Hyper-V on following Windows servers: 2012 R2, 2012, 2008 R2, 2008. The environment is very dynamic, VMs are getting created and deleted very frequently. Our intention is to get notified by any means on VM creation/deletion,
    currently we are relying on event-logs (we are OK with any different mechanism for such notification if there exists, i,e other than event-logs)
    We were able to get event-logs only on few of our 2012 R2 server on creation/deletion of VMs. On another 2012 R2 server, we did not got any such event (do we need to make some settings on 2012 R2 to get events? If yes, what are those settings).
    Also we are not getting any such event of VM creation/deletion on our Windows Server 2012, 2008, 2008 R2. Is there any setting required on hese host computer to get Hyper-V event-logs in "Event Viewer" for VM creation/deletion?

  • How to run a EXECUTE IMMEDIATE statement in a Interactive Report

    Hello all!!
    I need to make a dinamic construction of a query to execute in a Interactive Report, but the Region Source only allows simple SELECT statements. There is any way to run a EXECUTE IMMEDIATE statement in a Interactive Report Region Source?
    Regards Pedro.

    Thank you Andy for your reply.
    I have been testing for a while the use of a collection in the interactive report but i am unable to load data in the interactive report.
    I created the collection successfully in the SQL Commands with the code:
    declare
    v_sql varchar2(32000);
    begin
    v_sql:='select ename, job from emp';
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY('coleccao_emp',v_sql,'NO' );
    end;
    I tested successfully the creation of the collection with the query:
    SELECT c001, c002
    FROM APEX_collections
    WHERE collection_name = 'COLECCAO_EMP'
    My problem is: the data of the collection are returned in the SQL Commands but when i run the query statament in an interactive report, report or even a Pl/Sql region in my application the data aren't displayed, only the message (No data found).
    Can someone explain why, besides the collection is populated the interactive can not print the results.
    Regards Pedro.

  • How to run GINA when windows log off ?

    I test pGina program which was create from GINA. I want create program for logon windows with C#. I wonder when user log off windows why pGina can run application for login windows. I think application can run when start windows only . How pGina can run
    program when user click log off button ?

    Hi mmc01,
    I'm afraid you posted your question on the wrong forum. This forum is dedicated to Project Server concerns, the Microsoft enterprise scheduling & planning application.
    Please go to an appropriate forum in order to have an helpful hand.
    Cheers.
    Guillaume Rouyre - MBA, MCP, MCTS

  • How to trigger event when changing user status?

    hi,
    I'm having problems in triggering my workflow.
    In CIC0, When a status of a service request is changed to 'solution provided' then after saving service request, it should send a notification mail. I'm using ZBUS200116 which is deligated to BUS2000116. I've created event 'change' in ZBUS200116 which is in the start events of my workflow.
    I've tried creating an action profile which uses my workflow. The action profile is attached to the transaction but still it doesn't trigger my workflow.
    i've checked other existing workflows which uses the same object type BUS2000116 or ZBUS200116. These workflows were triggered by 'created' and 'completed' events only. Other added events in ZBUS200116 like 'changed' is not triggered. How is this possible when ZBUS200116 is deligated to BUS2000116?
    Your response would be highly appreciated.
    Thanks in advance.

    hi juan
    so here we are,now i got complete understanding of what u r doing and why
    you know you need not have created that change event because it wont serve your purpose anyway
    the reason is that because the way process in your workflow is flowing ,it wont happen that way using change event
    you just follow these  steps:
    1, use created event in your workflow
    2. that way when your contract ios created in rpocess status the event will be triggered only because you are creating a transaction whatever may be the status,so in all such cases you should use event created.
    3. now coming to the point of change in status or documents in contract
    in this case using loop will put you in deadlock and you will only be haing the error in such case
    you use WAIT step instead ,inside it use wait using conditions out of every option
    there you give your condition as change in whatever status
    like if you are chaning the status from in process to some other status ,put that status inside the condition
    as soon as that conditioon is met ,the WAIT step will be executed,
    that way you will be able to trigger the change in status through thje workflow
    so thats the solution with the approach you are using
    there are many approaches you can follow in workflows ,so depending upon that you can follow the different worlkflow tools u have there.
    also remember when your wait step gets executed there is always the time lag of 20-25 minutes after which changes will be reflected
    hope it will solve ur probs
    best regards
    ashish

  • How to Fire Trigger, when changes are applied on destination??

    Hi,
    I want to fire the following trigger at destination, when changes are applied from source table (cms.test_2) to destination table(cms.test_2).
    create or replace trigger Ins_and_upd
    after insert or update of send_status on cms.test_2
    declare
    begin
    update cms.test_2
    set RECEIVE_STATUS = 'YES'
    where UPPER(send_status)=upper('YES');
    end;
    Thanks,
    faziarain

    I am using oracle10g stream replication, and database version is "10.2.0.1.0".
    Basically I have 2 machines named:
    --> Site#1_DB ----> Having Table TEST_2 -----> Columns (BID,DBID,Send_Status,Receive_Status,Final_Status).
    --> Center_DB ----> Having Table TEST_2 -----> Columns (BID,DBID,Send_Status,Receive_Status,Final_Status).
    My Senario example is following:
    At Site#1_DB TEST_2 Table contains the following data:
    TEST_2 is updating and set the YES value in "Send_Status" column, and this change will replicated to Center_DB TEST_2 table.
    BID----------DBID----------Send_Status----------Receive_Status----------Final_Status
    1----------2----------YES----------NULL----------NULL----------NULL
    2----------3----------YES----------NULL----------NULL----------NULL
    3----------4----------YES----------NULL----------NULL----------NULL
    4----------5----------YES----------NULL----------NULL----------NULL
    At Center_DB TEST_2 Table contains:
    In My Senario changes are successfully replicated at Center_DB TEST_2 Table and after replication
    Test_2 table is same on both machines.
    But Now I want to write my given trigger at Center_DB and this trigger will be fired when changes are replicated
    from Site#1_DB to Center_DB.
    BID----------DBID----------Send_Status----------Receive_Status----------Final_Status
    1----------2----------YES----------NULL----------NULL----------NULL
    2----------3----------YES----------NULL----------NULL----------NULL
    3----------4----------YES----------NULL----------NULL----------NULL
    4----------5----------YES----------NULL----------NULL----------NULL
    Output After Firing the trigger at Center_DB:
    BID----------DBID----------Send_Status----------Receive_Status----------Final_Status
    1----------2----------YES----------YES----------NULL----------NULL
    2----------3----------YES----------YES----------NULL----------NULL
    3----------4----------YES----------YES----------NULL----------NULL
    4----------5----------YES----------YES----------NULL----------NULL
    Thanks,
    Faziarain.
    Edited by: [email protected] on Mar 30, 2009 10:00 PM
    Edited by: [email protected] on Mar 30, 2009 10:17 PM
    Edited by: [email protected] on Mar 31, 2009 3:48 AM

  • How to keep the waveform chart updated when changing states in state machine/

    Hello Everyone,
                           Can anyone please sugest me how to keep the waveform chart updated even if I am changing the states in a state machine??
    I am having analog inputs on the waveform chart...
    Thanks in advance...
    Now on LabVIEW 10.0 on Win7

    hello guys,
                    thanks a lot for the suggestions, here is the attached code... please follow the following steps to run it..
    ONce you hit play,press either Start Main/Cyl UP button on the front panel,
    once you start observing the waveforms, you can press the Cyl_Dwn button on the front panel... You can observe that the state changes to Start Counter state,
    and the waveform chart also stops updating... I would like both the waveform charts to conitnuously show the data even if the state is changed....
    Now on LabVIEW 10.0 on Win7
    Attachments:
    Soda Vending MAchine.vi ‏212 KB

  • How to disable ATP when changing pricing date

    When header pricing date in a sales order is changed, system triggers ATP. How can this be disabled?
    Edited by: Jennifer Lua on Feb 22, 2010 10:10 AM

    in material master Sales:general/plant data Availability check field enter no check and at the same time in VOV8 flag the availability check field.

  • How to run something when laptop lid is closed?

    Hi,
    I'm running Arch on my EEEpc 1000h. I'd like to run certain commands when I close the lid. Can this be done?
    Thanks in advance.

    Check the aur for acpi-eee and acpi-eeepc-generic. Install one of them and configure it to do a specific task when the lid is closed.

  • How to run function

    i created function to see output how should i
    thanks in advance

    you can
    select myfunction(params) from dual
    or if it inserts/updates/deletes then
    DECLARE
      v_out  <type of output variable>
    BEGIN
      v_out := myfunction(params);
      dbms_output.put_line(to_char(v_out) );
    END;

Maybe you are looking for

  • WARNING: Adjust Date & Time doesn't work

    I bought Aperture 2.0 because I was thrilled they finally have an adjust date/time feature. The interface is great, but it simply doesn't work. I was trying to adjust a batch of images by 30 seconds to get it in sync with another camera, however, it

  • ITunes 7.3.1 (3) - odd burn issues after update

    I'm using the latest version of iTunes running OS X 10.4.9 When I try to burn a disc, I get the following error... The attempt to burn a disc failed. The device failed to calibrate the laser power level for this media. Before I upgraded, I could burn

  • Can Send Mail, But Can't Receive Mail (Post Safari 3.1 & Security Update)

    Weird! I was able to receive mail when I first came in today, but since updating this morning to Safari 3.1 and Security Update, unable to receive messages. In "Activity Viewer", I can see Mail trying to get messages but stalls on "Fetching new mail.

  • How can I add mount points to a guest OS?

    Hi folks, Still a newbie here but learning. I've got an VM Server installed on a host I've downloaded and successfully started an Oracle Enterprise Linux guest (from the template downloaded from Oracle) I want to add more disk space to the guest now.

  • Disoverer Business Area and Timestamp

    I'm using BI Discoverer 10.1.2.1 and when I create a new business area any Timestamp fields are not imported. They are just not there. I switched one field to a Date and it imported fine. Is it the case that BI Discoverer 10.1.2.1 can't cope with Tim