PDA

View Full Version : a X axes slider in a loaded movie.



n0-order
September 12th, 2002, 07:53 AM
:-\

I have a moive with a sliding arrow that only sides arrow the X axes. I worked on it and Ive go it to work in a movie using this scripted.
//
mouse_x = _xmouse;
setProperty (_root.follow, _x, mouse_x+((getProperty(_root.follow, _x)-mouse_x)/1.15));
//

with the arrow in its own movie, instance named 'follow'.

its works fine.. http://www.no-order.co.uk/flash2.html

but then on my main index page (anther flash movie) when I do load movie into target I find that the whole loaded movie moves not the arrow.

It has something to do with parents moives I guess but I dont know any help wouldnt go a miss.

pom
September 12th, 2002, 08:29 AM
Hi n0,
You have to make your code _root independent. Because the _root of the loaded movie is no longer the _root when you load it. I don't know if this is clear...

Basically, you have to remove all the references to the _root in your code. You can use _parent instead, or nothing, when it is not necessary.

And drop the Flash 4 syntax:
// this sucks
setProperty (_root.follow, _x, mouse_x+((getProperty(_root.follow, _x)-mouse_x)/1.15));

// that's the way I like it
_root.follow._x=mouse_x+(_root.follow._x-mouse_x)/1.15;pom :asian:

n0-order
September 12th, 2002, 09:44 AM
I replaced what I had..

mouse_x = _xmouse;
setProperty (_root.follow, _x, mouse_x+((getProperty(_root.follow, _x)-mouse_x)/1.15));


with what you gave me.

_root.follow._x=mouse_x+(_root.follow._x-mouse_x)/1.15;

and the follower just didnt follow in either the movie or the loaded movie.

n0-order
September 12th, 2002, 09:47 AM
Ive got it to work now.. like you said I didnt even need the _root at all.. or parents


I deleted all _roots and it works now.

//working code
mouse_x = _xmouse;
setProperty (follow, _x, mouse_x+((getProperty(follow, _x)-mouse_x)/1.15));

pom
September 12th, 2002, 09:52 AM
Cool, but you should really get rid of the getProperty/setPRoperty.