View Full Version : trigger script with a link in a text field
Lifeforce
September 11th, 2003, 03:12 PM
is it possible? if so, how?
Voetsjoeba
September 11th, 2003, 03:17 PM
Do a search on "asfunction" ;)
Lifeforce
September 11th, 2003, 03:24 PM
thanks! asfunction wasn't even mentioned in the thick *** book i bought
claudio
September 11th, 2003, 03:52 PM
Yea, its an undocumented command.
http://www.macromedia.com/support/flash/ts/documents/asfunction.htm
Lifeforce
September 11th, 2003, 04:11 PM
i can't get it to work using this test code...
function test(){
trace("hi");
}
createEmptyMovieClip("foo",1);
foo.createTextField("hi_txt",1,0,0,120,20);
foo.hi_txt.html=true;
foo.hi_txt.htmlText = "<a href=\"asfunction:test\">click</a>";
nothing happens when I click on "click". Any help?
Eric Jr.
September 12th, 2003, 08:54 AM
yeah, weirdo, even the sample in the Documentation doesn't work for me ...
voetsjoeba?8-]
Voetsjoeba
September 12th, 2003, 11:22 AM
Eric - The sample function of the AS Dictionary works, but don't forget to set the HTML property to true :)
Lifeforce - Your code seems correct to me ... make sure you don't have any other objects on depth 1. That most likely causes the error. Set the depth to 9682 or something to make sure there is no other object with that depth.
Eric Jr.
September 12th, 2003, 12:05 PM
****, I'm 99% sure I did that .. maybe with wrong typecase or something, cause I have FlashMX04 :)
Weird .. but not worthy enough to break my brain on ...
Voetsjoeba
September 12th, 2003, 12:11 PM
Then it should certainly work. I tried it and it works flawless.
this.createTextField("txt", 1, 100, 100, 200, 20);
function MyFunc(arg) {
trace("You clicked me!Argument was "+arg);
}
txt.html = 1;
txt.htmlText = "<A HREF=\"asfunction:MyFunc,Foo \">Click Me!</A>";
*Don't edit your post that fast ! :P Anyways, an example never hurts.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.