Link (a href) to functions with AS3

Flex Add comments

Two “Flex” posts in a row! Maybe today will be the day Im having more than 40 visitors!

Você precisa ter o Flash player 9 para ver este conteúdo

CODE:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application
xmlns:mx=”http://www.adobe.com/2006/mxml”
layout=”vertical”
width=”200″ height=”200″
creationComplete=”initApp()”>

<mx:Script>
<![CDATA[

private function initApp():void{
txt.addEventListener(TextEvent.LINK, myFunction)
}
private function myFunction(evt:TextEvent):void{
trace("YEAP IT WORKS!");
lb.text="YEAP IT WORKS!";
}
]]>
</mx:Script>

<mx:Text id=”txt”>
<mx:htmlText>
<![CDATA[
<a href="event:eventText">Click here</A><br/>
]]>
</mx:htmlText>
</mx:Text>

<mx:Label id=”lb” text=”Does it works?”/>
</mx:Application>

2 Responses to “Link (a href) to functions with AS3”

  1. Junior Says:

    Eu consigo pegar o onMouseOver da mesma forma??

  2. gabrielaperry Says:

    Não entendi a pergunta… Queres saber quando passa o mouse sobre o link? Não sei se pode… Digo, usando dentro do htmlText, dentro do
    Mas podes captar o MouseOver do Text…

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in