Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : is "drag" the best method for...?


Hiltonkeith
2/12/2004 9:58:24 PM
*This message was originally posted while the forum was down last weekend. I
won't post it again if I don't hear from anyone, but since there were technical
difficulties...?

Hi all. I am trying to build a swf with an image of a doghouse. Within the
doghouse is a clip of eyes. "Eyes_mc" follows the mouse within the coordinate
restraints of the doghouse door. I used the drag method to do that. The
problem is, nothing else on the stage works - like links, or the checkbox to
tell the eyes to "stop watching". I don't want to use a button to start the
movement; I want it to happen automatically

I'd appreciate your help.

This is the code I used on "eyes_mc". I tried to save it in another swf and
load it into different levels (using loadMovieNum), like 1 and 15, but that
didn't work either.

onClipEvent (load)
top=_y-13
bottom=_y+15
left=_x-3
right=_x+5
startDrag ("", true, left, top, right, bottom);
dragging=true


Thanks so much
h
Jack
2/12/2004 11:12:41 PM
make each eye a separate clip, and add this clip action to each-

onClipEvent(enterFrame){
adj = this._x - _root._xmouse;
opp = this._y - _root._ymouse;
tanA = opp/adj;

this._rotation = (adj<0) ?
(Math.atan(tanA))/(Math.PI/180)-90 :
(Math.atan(tanA))/(Math.PI/180)+90;
}

regards,
Jack.


[quoted text, click to view]

Hiltonkeith
2/13/2004 2:01:27 AM
AddThis Social Bookmark Button