Trace()

hi
In my main time line i’ve 2 frames: one with a textbox as input text called “escrevaAqui” and a script frame with the following code:
“var escrevaAqui;”. Both are on frame 1.
When i preview the movie and write something in this box, nothing appears in the output window.
What am i doing wrong?

I don’t understand why you have 2 frames for.

pom 0]

just a matter of organization: one for graphics and so on and another just for code…

OK, you have 2 layers then… Did you trace the variable ? trace (writehere) if that’s what it means ?

pom 0]

:slight_smile:
sorry
yes, 2 layers, not frames; and an input box named: “nome”
i wrote:
var nome;
trace(nome);

now, the output window doesnt write what i wrote in the input box!

Might be a lot of things. Send me the fla : [email protected]

pom 0]

I know what’s wrong. The movie’s not looping. Put your code inside a movie clip, with a onClipEvent (enterFrame handler. And loose the variable declaration, it’s of no use.

pom 0]

“Well, with your code, the code is executed only once, at the beginning
of the movie. In order to make a loop, you have to set up a movie clip
that will execute the code on each new frame, which translates into
Flash to onClipEvent (enterFrame).
That’s all !”
So what’s wrong with my code? i’d prefer it written only once, without mcs. Can it be made?
I know, because i made it, the trace appear if i put a button that has a code to write the value of the “nome” variable in an dynamic text box…

Of course it’s possible, but you need a LOOP !!
I’ll send it to you.

pom 0]

thanks again
so…no loop no trace()?

You can trace without a loop, but with a loop, you can check the evolution of the data. Without you can’t.

pom 0]

may i see a code example of trace() without loop?

Just put trace (yourvariable) somewhere in your animation !! For instance, it can be used to check if a movie or data has been correctly loaded, or when you duplicate a clip, to check that the movies actually duplicated… All kinds of stuff. It depends onwhat you’re doing.

pom 0]

i feel dumb…
imagine i’ve just one layer with some text in it and an input box
what i want is to trace() whatever is written into that box…and without a loop
is it possible? How?

imagine i’ve just one layer with some text in it and an input box
I don’t understand what that means. What do you want to trace it for anyway ?? You can’t use that…

pom 0]

imagine its where a user inputs her name
what i want is to trace() … her name
cant i?

Well, you could put your textbox, plus a button with the code

 on (press) {trace (_root.text)}

I still don’t understand why you want to trace. Do you know that tracing doesn’t appear in the final animation ?

pom 0]

yes…:slight_smile:
i’m reading actionscript the definitive guide and the author uses the trace; as i’m beguinning at it, i’d like to use it in this example of mine.
just that.
but i guess i cant do it like i thought…i thought i could use it whenever i wanted to know (trace) something, without further complications

Well, you can, but the data has to exist when you trace, and you have to find the right path to get to the data.

pom 0]