Help! with mouse pos and dynamic text

I put this script on the movieclip of background which is present the entire flash project.

onClipEvent(mouseMove){
x_pos = _root._xmouse;
y_pos = _root._ymouse;
}

Then I create a ‘dynamic text’ object. With variable set to ‘x_pos’ (why is it that I have to make the title of this text object ‘x_pos’ as well?)

This is what the text spits out at runtime:

_level0.x_pos

What is the deal?

Thanks for any help
RR

you don’t have to make the name of the text box ‘x_pos’, just the variable. that might be causing your problem.

put this in frame 1 instead:


_root.createTextField("mouseTracker",1000,0,0,0,0);
mouseTracker.f = new TextFormat("Verdana",10);
mouseTracker.autoSize = "left";
mouseTracker.selectable = 0;
mouseTracker.onMouseMove = function(){
	this.text = "x:"+_root._xmouse+"
y:"+_root._ymouse;
	this.setTextFormat(this.f);
}
Mouse.addListener(mouseTracker);

then you don’t need a movieClip.

the problem you were having was that when you put your actions on a movie, you were setting those variables in that movie’s timeline.

a slight adjustment:


onClipEvent(mouseMove){
   _root.x_pos = _root.xmouse;
   _root.y_pos = _root.ymouse;
}

putting that on a movie and leaving everything else will solve your problem, since it’s putting the variables on _root which is where your text box is looking for them.

or use the code i put above and forget about miscellaneous movies. : )

The macromedia tutorial I was reading says to place

ClipEvent(mouseMove){
x_pos = _root._xmouse;
y_pos = _root._ymouse;
}

On any frame of the top level so the mouse pos is always updating. But when I go to publish, I get an error say clip actions can only be placed on movie clips.

When I place the above ascipt on a movieclip, I get no mouse coords, even when I roll over the box.

If I put just the

x_pos = _root._xmouse;
y_pos = _root._ymouse;

Then I get the initial mouse coords when the file started, but it doesn’t update. Help!!!

RR