CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Adobe Flex (http://www.codingforums.com/forumdisplay.php?f=63)
-   -   How do you change states with hyperlink? (http://www.codingforums.com/showthread.php?t=241050)

DevilRay 10-15-2011 09:45 PM

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.

Inigoesdr 10-16-2011 05:46 AM

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>



All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.