3 Replies - 6821 Views - Last Post: 06 August 2008 - 10:11 PM

#1 cadeownz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 12-July 08

onRollOver move x or y position of a movieclip

Posted 05 August 2008 - 09:28 PM

hey,
i need a code that makes it so when i rollover a movieclip another movieclip moves in x or y direction. so say i have a box and a circle:
[] (). if i put my mouse over the box [] the circle () moves like this ()-->()
by changing the x position. i know how to make stuff move with key press's but was wondering if it was possible to put ur mouse over something and make another movie clip move. NOT the one i put my mouse over.. Please help, need desperatly for a game im making.
thanks in advance!
:pirate: :pirate: :rolleyes: :rolleyes: :pirate: :pirate: :crazy: :crazy: :P :P :) :) :D :D

Is This A Good Question/Topic? 0
  • +

Replies To: onRollOver move x or y position of a movieclip

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1105
  • View blog
  • Posts: 6,918
  • Joined: 07-September 06

Re: onRollOver move x or y position of a movieclip

Posted 06 August 2008 - 11:49 AM

I would say make the rectangle (box) have an onrollover and rollout function that initializes the x and y positions of the mouse like so:

var mouseOn:Boolean = false;
var xi:Number;
var yi:Number;
this.onRollOver = function(){
  mouseOn = true;
  xi = _root._xmouse-this._x;
  yi = _root._ymouse-this._y;
}
this.onRollOut = function(){
  mouseOn = false;
}


Then make the onmousemove function check if the mouseOn if true, if so it should do something (move the circle xc-xi and yc-yi that way it will more the circle when the mouse is over the box but not when it isn't and will only move it relative to the mouse movement.

Go ahead and try to make this function yourself and I will help if you get stuck.
Was This Post Helpful? 0
  • +
  • -

#3 cadeownz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 12-July 08

Re: onRollOver move x or y position of a movieclip

Posted 06 August 2008 - 09:06 PM

---------------The following text probly sounds real nooby-----------------

Hey at first glance i noticed this could not possibly be a mc script. so where should i put it? frame mc? please i need to know lol. But thnx for helping. :D :D :) :D :) :D
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1105
  • View blog
  • Posts: 6,918
  • Joined: 07-September 06

Re: onRollOver move x or y position of a movieclip

Posted 06 August 2008 - 10:11 PM

This script would go inside of the box mc.

HTH
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1