change:

public function setOldState(evt:StateChangeEvent):void

to

public function setOldState(evt:MouseEvent):void

since click is a MouseEvent

mike chambers

[EMAIL PROTECTED]

Jeremy Rottman wrote:
> this is code that I am trying. But it gives me this error.
> 
> Implicit coercion of a value of type 'flash.events:MouseEvent' to an
> unrelated type 'mx.events:StateChangeEvent
> 
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> currentStateChanging="setOldState(event)" width="907" height="519"
> xmlns="*">
> <mx:Script>
>       <![CDATA[
>                import mx.events.*;
> 
>         public var prevState;
> 
>        
> 
>         public function setOldState(evt:StateChangeEvent):void
> 
>         {
> 
>                 prevState = evt.oldState;
> 
>         }
>       ]]>
> </mx:Script>
>       <mx:states>
>               <mx:State name="test">
>                       <mx:AddChild position="lastChild">
>                               <mx:Button x="173" y="454" 
> click="setOldState(event)" label="Button"/>
>                       </mx:AddChild>
>               </mx:State>
>       </mx:states>
>       <mx:Button x="31" y="454" click="currentState = 'test'" label="Button"/>
> </mx:Canvas>
> 
> 
> --- In [email protected], "Ashish Goyal" <[EMAIL PROTECTED]> wrote:
>> There is typo:
>>
>> "and in the event handler set some variable to the event.OldState" 
>>
>> Its event.oldState (lower case o)
>>
>> -Ashish
>>
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[EMAIL PROTECTED] On
>> Behalf Of Ashish Goyal
>> Sent: Monday, April 10, 2006 3:03 PM
>> To: [email protected]
>> Subject: RE: [flexcoders] Calling previous state
>>
>> You can use newState and oldState properties of the StateChangeEvent.
>>
>> There is another event "currentStateChanging" which you can define on
>> the application tag and in the event handler set some variable to the
>> event.OldState. 
>>
>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>> currentStateChanging="setOldState(event)">
>>
>> In the script block:
>>
>>      import mx.events.*;
>>      public var prevState;
>>      
>>      public function setOldState(evt:StateChangeEvent):void
>>      {
>>              prevState = evt.oldState;
>>      }
>>
>> You can set your currentState to prevState to go to the previous state.
>>
>> Hope this helps.
>>
>> -Ashish
>>
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[EMAIL PROTECTED] On
>> Behalf Of Jeremy Rottman
>> Sent: Monday, April 10, 2006 2:00 PM
>> To: [email protected]
>> Subject: [flexcoders] Calling previous state
>>
>> I am working on my app, and I have run into a situation where I need
>> change states and then when a user saves it takes them back to thier
>> previous state. Is there something like previousState?
>>
>>
>>
>>
>>
>>
>> --
>> Flexcoders Mailing List
>> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> Search Archives:
>> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
>> Yahoo! Groups Links
>>
>>
>>
>>  
>>
>>
>>
>>
>>
>> --
>> Flexcoders Mailing List
>> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> Search Archives:
>> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
>> Yahoo! Groups Links
>>
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to