views:

13

answers:

1

Hi,

I have general text in CDATA in my xml which is pulling in content into Flash. This is working well and I am able to add images this way too. What I need though is to wrap that image in an tag which, when clicked on will fire off a function in my Actionscript 2 to launch a video.

Could someone please tell me how I would go about this? Is there a better way than the way I am thinking right now?

Thanks.

A: 

I recently did this in AS3 but I found the AS2 way.

Tested it:

function myFunc(arg:String):Void 
{
     trace ("You clicked me!Argument was "+arg);
}

myTextField.htmlText ='<a href="asfunction:myFunc,Foo">Click Me!</a>';

You just use a href that is set to asfunction with a function name and something to pass along.

See:

http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary073.html

Just to give credit I found the initial code at: blog.activepoison.com/?p=25.

Billy
Thanks Billy!!! I will look into this! :)
Sixfoot Studio
Hi Billy, I tried a simplified version of this and looked at the AS3 example in the link you sent and I got it working. I can't seem to get it working my biiger project though and I am not sure if this is because the function is just not being hit at all. The xml content is being pulled in on the 6th frame and I've moved it to the root and the 6th frame without any joy. Can you think of something else it might be? Cheers
Sixfoot Studio
Not really sure. I never really did much AS2. Is your asfunction is on the same frame as the textfield? (Not on the textfield, not sure if that matters). Maybe you can make a class that has the textfield in it, you pass you some text and inside your class you have your function and you dispatch some event to root.Without seeing the code it's hard to guess why it isn't working.
Billy