Ilyaslamasse: link into a dynamic text

To continu with our discussion…
Ref. yesterday.I would like to put a link inside a dynamic text (news.txt) to a frame label (special)???

My frame label (special) is on my timeline (13).
It’s my dynamic text (news.txt) that is loaded into my mc (news)
is why I have :
loadText = new loadVars();
loadText.load(“textes/news.txt”, “_root.news”);

I thank you in advance for your time or your file like.

Corinne

Just to say that I’m working on it, and that you shouldn’t have created another thread… :cowboy:

pom :slight_smile:

OK, here you go:

I have a text file called corinneText.txt that contains

&label=special
Then in the Flash movie, which is located in the same folder as the text file, I have a first frame with some code in it and another frame later with the label special.

This is the code in the first frame:

stop();

/*** Preparation ***/
_root.createEmptyMovieClip("news",-1);
_root.createTextField("a",0,0,0,200,100 );
a.html=true;

/*** Loading ***/
loadText = new loadVars();
loadText.onLoad = function() {
		a.htmlText = "<a href='asfunction:gotoAndStop,"+this.label+"'>Go to the frame Special</a>";
};
loadText.load("corinneText.txt", "_root.news");

The syntax is the following: asfunction:functionToCall,parameter(s).

Here you call gotoAndStop, with the parameter this.label that comes from your text file.

Cheers. Pom :cowboy:

I think this should be put in the Best of Kirupa, so could you please rate the thread?

thank you so munch. You are to cool.
I don’t know how I it would be possible to do without your precious help.
I’m going to try now.

I’m sorry for the new thread.
The rate is on best.

Corinne

this is code excelent!!!
i have just a question!
what is the as function that youn use in the code?thanks!!

bowing down back hurting a bit

Well, ASfunction is -was- undocumented AS, I think, but it should be in the last update of the AS dictionary.

Basically, when you put that in a link, it allows you to call a function when you click a link. You can of course define your own function that will do whatever you want, or call a predefined function like we did here. You can see the syntax in the example.

I’ll probably put that in the AS tricks some day [SIZE=1]when my exams are over… and when Kirupa updates his site…[/SIZE]

pom C:-)

nice!!:slight_smile:

This is what I have done by fallowing your advice:

in my text file “corinneText.txt” I have:

sTextA =KP special
name of the film
a href=“special” More info /a
&label=special

in my flash movie I have on the timeline:
frame 1 : my movie Clip “news” with a instance name “news”
frame 13: a frame Label “special”

in my movieclip “news” I have on frame 1:
a dynamic text with the name “scroller” and a var name"sTextA"
and a scroller with a Target text field “scroller”
an action layer:

stop();
/*** Preparation ***/
_root.createEmptyMovieClip("news",-1);
_root.createTextField("a",0,0,0,200,100 );
a.html=true;

/*** Loading ***/
loadText = new loadVars();
loadText.onLoad = function() {
        a.htmlText = "<a href='asfunction:gotoAndStop,"+this.label+"'>Go to the frame Special</a>";
		scroller.text = this.sTextA;
		scroller.html = true;
		scroller.htmlText = this.sTextA;
};
loadText.load("corinneText.txt", "_root.news");

what is wrong? and where?

Thank’s again and again,
Corinne

*Originally posted by corinne *
**in my text file “corinneText.txt” I have:

sTextA =KP special
name of the film
a href=“special” More info /a
&label=special
**
Is that what you have in your text file? Just like that? Because it won’t work that way. You have to separate your variables with &. Something like:

sTextE=KP special&name=name of the film&label=special
pom :asian:

well yes. but it work’s. I added only the tag for the fonts and the colors and the link for each text.
Because I call the var “sTextA” defined in my flash movie (dynamic text name) all my text are loaded.

Is it ok??

But the link that way is not working
a href=“special” (with the tag of course)
What is the correct link beside the &label=special ??

Corinne

I don’t understand. Can you zip the file with the text file and post it here? If it’s too big, mail it at [email protected]

pom :cyclops:

I sended to your hotmail address last night.

Corinne

Hum, you mixed up a bit everything… I had made the preparation because I didn’t have the right clips and textfields set up, so you don’t need it.

I had to change the code in the loading too, nothing too important.

The error was in the text file: everything has to be on 1 line, and there should be any space between the variable name and the variable itself.

label=special -> good
label =special -> not good.

Cheers.

pom :cowboy:

I don’t know how to thank you! You are such a good helper.

What would you advise :
I absolutly love flash, and want to keep progressing. What training would you advise to improve ?
Until know my knowledge come by trying stuff. As a graphic designer I develop my concept, I sell to my client and after I look for the “how I’m going to do that”.

Corinne

:cowboy: Welcome :slight_smile:

And it depends on what you want to improve: your scripting skills or your design skills…

pom :asian:

my scripting skills

Experimental or just for a site?

I love to apply what I learned.
So it will be for sites.

Well, Keith Peters swears it is a great book: http://www.friendsofed.com/books/studio/flash_mx/index.html
On the other hand he helped writing it…

And check friends of ed (http://www.friendsofed.com) they usually have good stuff.

And what if you want to use characters like “ú”, “é” etc?
because if you would use characters like this, the text would display a square

Andreas