Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How do you change states with hyperlink?

    I would like to be able to change states in a Flex WindowedApplication by clicking on a RichEditableText hyperlink or some form of clickable text. Is there a way to do this? Thanks.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    			   xmlns:s="library://ns.adobe.com/flex/spark"
    			   xmlns:mx="library://ns.adobe.com/flex/mx"
    			   width="434" height="100">
    	<fx:Script>
    		<![CDATA[
    			
    			protected function setState(stateName:String):void
    			{
    				this.currentState = stateName;
    			}
    			
    		]]>
    	</fx:Script>
    	
    	<s:states>
    		<s:State name="state1" />
    		<s:State name="state2" />
    	</s:states>
    	<s:RichEditableText x="38" y="45" text="Click Me! Set State 1" click="setState('state1')" />
    	<s:RichEditableText x="38" y="65" text="Click Me! Set State 2" click="setState('state2')" />
    	<s:Label x="276" y="45" text="Current State: {this.currentState}"/>
    	
    </s:Application>

  • Users who have thanked Inigoesdr for this post:

    DevilRay (10-17-2011)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •