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 <[email protected]>
> *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