Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]

Subject: hitTest
From: Craig Paterson
Date: Wed, 31 Jan 2001 13:01:30 -0000

Hi there all!

I'm currently working on a project in which I would like the detection of a
hitTest between two MC's (one called "line" the other "mc1") to trigger the
playing of frames in "mc1".

"mc1" has a stop in the first frame with static text.
Frame 2 has a label of "fadeIn" and a tween on the text.
Frame 11 has a stop action at the end of the tween.
Frame 12 has a label of "fadeOut" and a tween back to the original state of
the text.
Frame 21 has "gotoAndStop (1);"

The main timeline has only one frame.
Each item has it's own layer.
the MC "line" has the following script attached:-

// constrain mouse horizontally
onClipEvent (enterFrame) {
_root.line._x = _root._xmouse;
// determine if line hits mc1 and react accordingly
onClipEvent (enterFrame) {
hit = (_root.line.hitTest(_root.mc1));
if (hit) {
_root.mc1.gotoAndPlay ("fadeIn");
} else {
_root.mc1.gotoAndPlay ("fadeOut");

When the movie loads, "mc1" jumps to the stop action on frame 11 and doesn't
play the tween.
When "mc1" is hit by "line" it jumps back to frame 1 without playing the
When "mc1" is not hit by "line", "mc1" jumps to the stop action on frame 11
and doesn't play the tween.

I have tried using frame numbers instead of labels, and that makes no
difference either.
I really, really need those tweens to play properly.

I have posted the FLA if anyone would like to look at it and help me get my
head round this problem


Contact me off-list if you need to know more,

thanks in advance


Craig Paterson
Multimedia Developer

Vision Thing Design Consultants
67 Marionville Road
United Kingdom

t. 0131 659 2919
f. 0131 659 2917
i. 0131 652 2087
u. http://www.visionthing.co.uk
e. craigatvisionthing [dot] co [dot] uk (mailto:craigatvisionthing [dot] co [dot] uk)


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]