Your code is right, you just need a textfield with a link in it:

var a:TextField = new TextField();
addChild(a);
a.html = true;
a.htmlText = "<a href='iforgotname:sometext'>click here</a>";

----- Original Message ----- 
From: "Tom Bray" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Tuesday, January 31, 2006 2:33 AM
Subject: Re: [Flashcoders] How will asfunction work in AS3/MXML? Jester?


Thanks, Jesse.  I was able to find the right event using the code
hints in Flexbuilder (see below) but I'm stuck until I find out how
asfunction has changed so I can actually trigger the event.  I'll hold
my breath until the docs come back...

        import flash.events.*

private function init():Void
{
myTextArea.addEventListener( TextEventType.LINK, linkClickHandler );
}

public function linkClickHandler( event:TextEvent ):Void
{
myTextArea.text = "worked";
}

On 1/30/06, JesterXL <[EMAIL PROTECTED]> wrote:
> Docs are down, but here's some psuedo code for you:
>
> import flash.util.trace;
> your_txt.addEventListener(TextStuff.LINK, onHyperlinkClicked);
>
> function onHyperlinkClicked( event:Event )
> {
>     trace("You clicked on " + event.target); // your_txt
>     trace("The text is: " + event.text); // doSomething
> }
>
> I think asfunction is changed to something else; again, wait until the 
> docs
> come back up to get confirmation on WHAT it actually changed to, but 
> that's
> the basic code.  Whatever you store after the "newAsfunction:" is passed
> into the text property of the event.
>
> Only thing is, the text is just for context now, meaning doSomething is no
> longer a function that is called, and the comma no longer seperates that 
> as
> the argument; it's basically just text that is passed into the event, so 
> you
> could remove doSomething, and leave foo.  doSomething could be your event
> listener function passed to the textField.addEventLisetener for example.
>
>
> ----- Original Message -----
> From: "Tom Bray" <[EMAIL PROTECTED]>
> To: "Flashcoders mailing list" <[email protected]>
> Sent: Tuesday, January 31, 2006 1:33 AM
> Subject: [Flashcoders] How will asfunction work in AS3/MXML? Jester?
>
>
> If I have a link like this in a Flex2 TextArea like this:
>
> <a href='asfunction:doSomething,foo'>click here</a>
>
> Where do I put my doSomething() method?
>
> -Tom
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to