Help with controlling a movie clip

I came across this site and I’m thinking the coding I’d need to go about using is the same that I’d use to just control a movie clip

http://dlow.org/index.php?/projects/play-more--more-play/

I’m looking to do this not just with dots to spell words but to push it further.

Any suggestions on how it was accomplished and how it can be done?

The lower the mouse is the more the dots move to their second position, the higher the mouse is the more they move to their first.

Coding should be easy?

yes yes it should be easy, but i honestly am at a loss

AS 2 or AS 3?

Anyway;

original_x = 0
original_y = 0
destination_x = 100
destination_y = 100

The higher I have my ymouse the closer to destination_y and _x I want to move the object.
The lower I have my ymouse the closer to original_y and _x I want to move the object.

Notice how all the dots move in straight lines in the example you gave, so this is pretty much the code you want to use, nothing fancy at all I suppose. (Although I may be wrong)

onClipEvent (load) {
	this.originalx = 0;
	this.originaly = 0;
	this.destinationx = 100;
	this.destinationy = 100;
	this._y = this.originaly;
	this._x = this.originalx;
	this.xdevider = scenewidth / (this.destinationx - this.originalx);
	this.ydevider = sceneheight / (this.destinationy - this.originaly);
}
onClipEvent (enterFrame) {
	this._y = _root._ymouse / this.ydevider;
	this._x = _root._ymouse / this.xdevider;

}

Paste in a movieclip, AS2 (obviously).
30 FPS and it looks good.

Changeable variables:
this.originalx = 0;
this.originaly = 0;
this.destinationx = 100;
this.destinationy = 100;

scenewidth and sceneheight are should be declared on the frame with _global. or just typed in, obvious what they should be eh?

Yes yes I am a noob at AS don’t complain just trying to help.

hey im not complaining at all!!! im happy your willing to help and ill give it a try and see what i can figure out with my limited knowledge of flash as it is

No problem mate, happy to help out. Even though I am just a novice myself sometimes I strike gold :wink:

Just post if you need any more help mate.

well im about the same as you can see by the site i built with just teaching myself flash

www.mvadesigns.com

and everything you had suggested was all greek to me so ill have to play around and seew= what i can figure out

Very nice site mate :slight_smile: Good work!

Ill try to explain the code for you, since you seem to have problems with it.


onClipEvent (load) { //when the movie clip enters the stage it will activate the actions inside the {}s.
    this.originalx = 0; //starting position of the MC, x coordinate
    this.originaly = 0; //starting position of the MC, y coordinate
    this.destinationx = 100; //destination of the MC, x coordinate
    this.destinationy = 100; //destination of the MC, y coordinate
    this._y = this.originaly; //the MCs y position is set to the position of the originaly variable
    this._x = this.originalx; //the MCs x position is set to the position of the originalx variable
    this.xdevider = scenewidth / (this.destinationx - this.originalx); //the variable xdevider is set to the width of the scene devided by where it is going to where it is. Using the set variables right now it will be 400 / (100-0) = 400 / 100 = 4, so every 4 pixels you move the mouse the movie clip will move 1 pixel.
    this.ydevider = sceneheight / (this.destinationy - this.originaly); // same as above just with height and y instead, assuming you have different length of the scene's sides.
}
onClipEvent (enterFrame) { //every time the playhead moves over the frame, as many times per second as you have set your frames per second to, I use 30, so it does this 30 times per second.
    this._y = _root._ymouse / this.ydevider; //put the y coordinate of the movie clip (this._y) to where the mouse is devided by 4 (ydevider).
    this._x = _root._ymouse / this.xdevider; //same as above just with x.

}  // end

scenewidth and sceneheight are also variables, set to the height and width of your scene. I declared these in _root but you can put them into the movieclip if you want.

The reason for all the “this.” is to make the variables only set to the single movie clip you are using, so you can use the exact same variables for multiple movie clips.

God ■■■■ I suck at explaining, anyway hope it helped at least a little bit.