flash actionscript:
I'm creating a text box that will call a .txt file, but somehow I need to the text inside the textbox to behave like Flash buttons. I know I can use HTML code to have the text clickable, but I need the clickable text to have Flash actionscript properties. Is there a way to do this?
Jack- thanks for your help. I followed the link you gave me, but I can't get the asfunction to work. Here is the link inside my text file: <a href="asfunction:myFunction">here</a> and I put the following in the first frame of my flash movie: function myFunction() { getURL("yui.html"); } Everyting looks good, but I can't get it work. I can't figure out why. Any ideas?
a typical set-up could be - in the.txt - myText=If you'd like to blah, blah..<A HREF="asfunction:launchMail,mailto:you@your.home">LAUNCH MAIL</a><BR><BR>or perhaps you prefer...<A HREF="asfunction:launchWindow,http://www.yahoo.com">LAUNCH YAHOO</a><BR>.& in the movie - a textfield, variable name - myText, and code this.loadVariables("the.txt"); function launchWindow(url){ getURL("javascript:NewWindow=window.open('"+url+ "', 'Window','width=200,height=200,top=50,left=50,scrollbars=yes');void(0);"); } function launchMail(addy){ trace(addy); getURL(addy); } hope this simple example helps :)
Jack- thanks for your ongoing help. You example worked fine, but I tried to change it for more of what I needed it to do, and again I can't get it to work. I reused a lot of you code to try to help with the debugging: inside the .txt file and inside the a href tag: "asfunction:launchWindow,5" inside frame 1 of the flash movie: function launchWindow(value){ gotoAndPlay(value); } It seems like it should work as the launchWindow function is getting passed the value of 5, which the gotoAndPlay function should understand and execute though. When I play the swf file, I don't get a code error, but the link doesn't work.
variables are passed as strings, so use - function launchWindow(value){ trace(typeof value); gotoAndPlay(Number(value)); }; hth
Jack- Still no beans. I copied your code exactly: function launchWindow(value){ trace(typeof value); gotoAndPlay(Number(value)); }; and it didn't work so then I removed the trace() part of it and it didnt work... so then I got rid of the gotoAndPlay part and put in: trace(value); and that didn't give me anything on the output screen. Maybe this functionality is not supported within the asfunction command?
did the file from nITiNkIlLeRmEeRuT help ?? if not, please zip your fla and text file and upload to your webspace, provide a link for download and i'll have a look ;)
Hey it actually worked! Thanks nITiNkIlLeRmEeRuT! I saw how you wrote the text directly into the flash file, which wasn't my first choice, but since it works, then I'll go with it. Jack...thanks for all your help! While I couldn't get your solution to work exactly the way I wanted, it sure kept me from going mad over this project and I learned some new stuff. Thanks a bunch...have great weekend.
Don't see what you're looking for? Try a search.
|