Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Links in Flash from text doc

Status
Not open for further replies.

JaysunB

Programmer
Sep 29, 2006
15
US
Hi all.

I am pulling information out of a text document into my Flash movie. Using this method &name= and creating a dynamic field to house the information.

For instance: I have &URL=http://www.something.com and pull this information into the movie by dropping /:URL into the variable field. Of course I see static text rather than the link in the preview. Is there a way to import the URL as an actual clickable link?
 
Thanks for the reply kenneth.

I still cannot get what you suggested to work. I have two images I'm posting to make sure I'm doing it like you think I should be doing it.

1.jpg

2.jpg"
 
Oh, the first one is of course, the Flash window and the property box. The second image is the .txt file I'm using to pull the information from.
 
i think you need to use the instance name rather than the Var field to target the text field and use htmlText

ie myTextInstance.htmlText = URL;
 
Yes "Var" field in the TextField Properties panel is there for historical reason and you should not be using that.

In addition to Bluesman's post, you'll need to set the "html" property of the TextField to true.

You can either do:

myTextInstance.html = true;

or enable the button looks like "<>" in the Properties panel.

Kenneth Kawamoto
 
Thanks BluesmanUK.

I am not too savvy on AS2. Any chance you can explain this a bit further?

 
In response to what kenneth wrote:

I mentioned not being to AS2 savvy. Where would I put myTextInstance.html = true;

I have already tried to enable the <> on the property box. Apparently using the Var: field is not what I should have been doing.
 
To give your TextField instance a name, just type in a name (say "myTextInstance") in the field says "<Instance Name>".

Create a new layer in the Timeline and place these code:

myTextInstance.html = true;
myTextInstance.htmlText = URL;

You don't need the first line if you enable the HTML by selecting the "<>" button in the Properties.

Kenneth Kawamoto
 
Ohhh. Ok. I see where you're going with this. You're defining a dynamic text field with an instance name, referencing that name in the AS and setting the html code so that it displays in HTML rather than plain text.

Ok. I did everything as you suggested and now, in the dynamic field I named eMail, it says undefined.
 
I have a text file named adamsPetere.txt stored int he same directory as the movie. I am using loadVariablesNum("adamsPeter.txt", 0); to pull the information in and was using /:email, /:name, etc to pull the specifics. This was in the Var: field of the dynamic text box I created for each.

In the text I'm using &email, &name, etc.
 
spell correct on adamsPeter.txt --- I spelled it adamsPetere.txt in my last post.
 
It's undefined because when you are displaying the text the data is not yet loaded.

You'll need to set an interval to see if the data is there before displaying the text.

But I'd use LoadVars class instead of loadVariablesNum() - that's Flash 4. Time to move on!

Kenneth Kawamoto
 
Jeeze! I had no idea I was using such old technology. You can see how dated I am with that I guess.

You're talking circles around me though hahah. Sorry for my ignorance. I'm definitely trying to learn though.

So my method with the text file and &eMail, &name, etc is correct? I want to make sure I'm using the right methods in the text file as well as the AS.

I am not familiar with LoadVars class. How would I change the code I have to compensate for this newer and more effecient AS?

I'm using loadVariablesNum("adamsPeter.txt", 0); right now.
 
Aha!!

Got it!

var myTextInstance:TextField;
myTextInstance.html = true;

var lv:LoadVars = new LoadVars();
lv.onLoad = function(success:Boolean):Void
{
if(success)
{
myTextInstance.htmlText = this.URL;
}
};
lv.load("adamsPeter.txt");

stop();
 
I'm dedicated to learning this stuff. I want to learn it so badly. I am great at the motion end and graphics, web aspect of design but when I get into Flash and know what I want to see...I'm lost and it kills me not knowing how to do these simple proceedures. I actually bought a book a few days ago, Actionscript for Flash 8 by friends of ed. I have not dove into yet but I hear its a great learning tool for the newbs.

Not sure what the &3D in the URL is but it seems to be working. Hahaha.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top