all groups > flash actionscript > january 2005 >
You're in the

flash actionscript

group:

Dynamic text field with geturl link?



Dynamic text field with geturl link? tallscot
1/14/2005 11:05:53 PM
flash actionscript: Hey, I'm not strong in ActionScript. I have a project where I have dynamic
text fields on the screen that are linked to .txt files. I need each one to be
hot and go to a specific URL. Right now, I have this script: headline1 = new
LoadVars(); headline1.onLoad = onText; headline1.load('headlines.txt');
function onText() { headline1_txt.text = headline1.headline1; } On the main
timeline, I have a graphic with the instance label of headline1_txt. I can't
apply a geturl script to it. If I convert it to a movie clip, I can apply the
geturl, but then they dynamic aspect doesn't work. I appreciate any help.
Thanks
Re: Dynamic text field with geturl link? NSurveyor
1/14/2005 11:08:23 PM
headline1 = new LoadVars();
headline1.onLoad = onText;
headline1.load("headlines.txt");
function onText() {
headline1_txt.html = true;
headline1_txt.htmlText = headline1.headline1;
}

Now, in your textfile, use this instead: <a
href='http://www.somesite.com'>Some Text!</a>
Re: Dynamic text field with geturl link? tallscot
1/14/2005 11:13:07 PM
Thank you so much for the quick reply. I don't think I communicated what I
need well enough. I need the text in the dynamic text box to be the text in
the headlines.txt file, but I need each one of them to go to a different URL
when they are clicked on. I'm sorry, maybe I'm not understanding your answer.
Again, I'm not strong in ActionScript. Thank you so much.
Re: Dynamic text field with geturl link? tallscot
1/14/2005 11:18:02 PM
I tried creating a graphic symbol called headlines1 and I then put that into
another button symbol, but the dynamic text didn't appear when that button was
brought out into the main timeline. The dynamic text only appears when that
headlines1 symbol is in the main timeline. Maybe I'm making a newbie mistake
and I need to adjust the actionscript if I put the headlines1 instance one
level down from the main timeline? Thanks for the help
Re: Dynamic text field with geturl link? NSurveyor
1/14/2005 11:44:34 PM
You're welcome. And yes, you can implement a rollover. See this thread:
Re: Dynamic text field with geturl link? NSurveyor
1/15/2005 12:03:01 AM
For example, you could do this (require Flash MX 2004):

myCSS = new TextField.StyleSheet()
myCSS.setStyle('a:hover',{color:'#FF0000'});
headline1_txt.styleSheet = myCSS;
headline1 = new LoadVars();
headline1.onLoad = onText;
headline1.load("headlines.txt");
function onText() {
headline1_txt.html = true;
headline1_txt.htmlText = headline1.headline1;
}
Re: Dynamic text field with geturl link? tallscot
1/15/2005 12:06:07 AM
Very cool, it works!

I notice that my font is now plain HTML and the dynamic text field's font attributes are no longer being recognized.

Any way to make that a specific size?

Re: Dynamic text field with geturl link? NSurveyor
1/15/2005 12:45:17 AM
You're welcome. Sorry for not replying sooner.

You need to make a style for your normal text:

myCSS = new TextField.StyleSheet()
myCSS.setStyle('a:hover',{color:'#FF0000'});
myCSS.setStyle('normText',{color:'#0000FF',fontFamily:'Arial',fontSize:24});
box.styleSheet = myCSS;
box.html = true;

<normText>Hi, welcome<a href=\'http://www.google.com\'>Some Text</a></normText>
Re: Dynamic text field with geturl link? tallscot
1/15/2005 1:17:42 AM
Re: Dynamic text field with geturl link? NSurveyor
1/15/2005 2:16:40 AM
AddThis Social Bookmark Button