hey all,
i have worked out how to make the ball follow the mouse arrow but how do you make the two lines move together as in the flash file in the tutorial section?
Kip
hey all,
i have worked out how to make the ball follow the mouse arrow but how do you make the two lines move together as in the flash file in the tutorial section?
Kip
which tut are you refurring to?
you mean like a crosshair ?
ok open flash; make two lines, one horizontal, one vertical and make them twice as large or high as the movie - call them two different movies; linehorizontal and linevertical or whatever…
for each movie (or you could code it in one another movie) write these action
vertical bar:
onClipEvent(enterFrame){
this._x = _root._xmouse
}
and the horizontal bar
onClipEvent(enterFrame){
this._y = _root._ymouse
}
you could also make the crosshair, turn it into a movie clip and set its registration point to its center, and set a startDrag command. But the one on top is better (to learn - i mean)
hmmm when i do what uve just mentioned i get the lines moving but not staying together to make perfect cross
this.onEnterFrame = function () {
_root.createEmptyMovieClip("horz", 0);
_root.createEmptyMovieClip("vert", 1);
//horizontal line
horz.lineStyle(0, 0x000000, 100);
horz.moveTo(0, _root._ymouse);
horz.lineTo((_root._xmouse+400), _root._ymouse);
//vertical line
vert.lineStyle(0, 0x000000, 100);
vert.moveTo(_root._xmouse, 0);
vert.lineTo(_root._xmouse, (_root._ymouse+400));
};
I love this API crap!!
[edit] by the way, make your stage 400x400 or change the two 400s above to whatever…[/edit]
humm not moving at all now lol ive prob put code in wrong i only learning sorry can u tell me what i put it atons for horiz and vert line ? sorry to causing hassle lol
Take all that actionScript and put in the first frame of the movie - make sure that it’s on a layer that exists throughout the movie. (make a new layer if you have to) :)?
what I did works absolutely fine for me: check the fla
the API thing is great too but a bit tough for a beginner =)
http://mlkdesign.online.fr/misc/kirupa/crosshair.fla
<embed src=“http://mlkdesign.free.fr/misc/kirupa/crosshair.swf” height=200 width=300" type=application/x-shockwave-flash></embed>
ahh haaa cheers beers! i only been at this for 3 weeks but heres a file ive been working on let me know what you think
Also can i make the lines already visible on the fla before the mouse is placed over it?
True, but I was excited because I could just made it work - I had to share it…
can i make the crosshair visable on the fla before the mouse is held over it?
Using MLK’s design (…teehee) add this before the onClipEvent(enterFrame) on both of the crosshair movieClips:
onClipEvent(load){
_x = 100;
_y = 100;
}
Adjust accordingly. For mine, it would take a little bit.
:: Copyright KIRUPA 2024 //--