all groups > flash actionscript > may 2004 >
You're in the

flash actionscript

group:

actionscripts inside a text file


actionscripts inside a text file azcummins
5/15/2004 8:55:21 PM
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?
Re: actionscripts inside a text file Jack.
5/15/2004 9:23:19 PM
Using asfunction, a text link can call a function that
can then perform a variety of ActionScript statements.

http://www.macromedia.com/support/flash/ts/documents/asfunction.htm

Re: actionscripts inside a text file azcummins
5/16/2004 11:16:15 PM
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?

Re: actionscripts inside a text file Jack.
5/17/2004 2:19:01 PM
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 :)
Re: actionscripts inside a text file azcummins
5/20/2004 6:42:09 PM
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.
Re: actionscripts inside a text file Jack.
5/20/2004 7:09:25 PM
variables are passed as strings, so use -

function launchWindow(value){
trace(typeof value);
gotoAndPlay(Number(value));
};

hth
Re: actionscripts inside a text file azcummins
5/20/2004 9:43:17 PM
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?
Re: actionscripts inside a text file nITiNkIlLeRmEeRuT
5/21/2004 2:00:05 AM
Re: actionscripts inside a text file Jack.
5/21/2004 1:50:51 PM
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 ;)
Re: actionscripts inside a text file azcummins
5/21/2004 4:34:27 PM
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.
Re: actionscripts inside a text file azcummins
5/21/2004 4:40:09 PM
Re: actionscripts inside a text file azcummins
5/24/2004 7:02:09 PM
ok, I'm back to square one now. Creating a scrolling dynamic text box was more
than a chore.

Jack - Here are the files you will need if you want to look at my code and fla
file:

http://www.futuresires.com/flash/scrollbar.zip
AddThis Social Bookmark Button