Seems to me that you may have two separate states and are really trying to use 
only one state when there should be two. What's the problem with having "state 
1" for "state 1" functionality and "state 2" for state 2 functionality?

Other possible solutions may be changing states then calling a function 
afterwards, or perhaps changing states and issuing an event. Really depends on 
what your special functionality is.

Paul
  ----- Original Message ----- 
  From: dorkie dork from dorktown 
  To: [email protected] 
  Sent: Wednesday, January 14, 2009 11:08 PM
  Subject: Re: [flexcoders]Change state without dispatching events


  I have specific functionality setup in the StateChange event (functionality 
type 1). But in another part of the class I have functionality (functionality 
type 2) that does some slightly different work. 

  The code looks like this:

  type 1:
  // someone sets the state in code (could be anywhere)
  // for example,
  Application.application.currentState = "state 1";

  this generates a state change event and the type 1 functionality is handled 
in a state change listener i have already setup

  type 2:
  // i set the state inside the class specifically where i want it to go
  // for example,
  Application.application.currentState = "state 1";

  this generates a state change event but i want type 2 functionality to run. 
so if i cancel the event then i can run type 2 code directly after this line. 

  i thought about using flags like this

  useType2Functionality = true;
  Application.application.currentState = "state 1";
  useType2Functionality = false;

  and then in the my state change listener i can check for this flag and either 
exit or add the code i want in there?


  On Wed, Jan 14, 2009 at 3:48 PM, Paul Andrews <[email protected]> wrote:


    ----- Original Message ----- 
      From: dorkie dork from dorktown 
      To: [email protected] 
      Sent: Wednesday, January 14, 2009 10:34 PM
      Subject: Re: [flexcoders]Change state without dispatching events


      Do you have a code example you can show me? 

      When I use this:

      Application.application.setCurrentState(stateName); 

      it always triggers a StateChangeEvent.CURRENT_STATE_CHANGE event. 

      I want to know if there is a way to not generate that event. None at all. 

    I'll ask the obvious question. Why don't you want to let components know 
that the state has changed?
    Makes me wonder why you are using states if you don't want the event 
propogated.

      On Wed, Jan 14, 2009 at 2:11 AM, p...@vin Uttarwar 
<[email protected]> wrote:

        Hi,
        Yes you can do it  using databinding,
        by keeping one of the variable which is aceessible from
        anywhere throughout the application [inside static class like 
ModelLocator] and according to
        its change you can change the state.



        2009/1/14 dorkie dork from dorktown <[email protected]> 


          Is there a way to change states without generating an event?







   

Reply via email to