|
-
Hit.Test Method
Im testing the hit Test method.
Ive got a movie which has two frames and two layers. One layer has the numbers 1 on the 1st frame and 2 on the second frame. The other layer has a rectangle spanning the two frames. My rectangle has this code in the object actions
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
} else {
gotoAndStop(1);
}
}
I want a simple detection so when the mouse is over the rectangle it goes to frame two. This script doesn't work
I don't understand
-
Senior Learner
If you are using Flash MX:
To perform collision detection between a movie clip and a point on the Stage:
1 Select a movie clip on the Stage.
2 Create a dynamic text box on the Stage and enter status as the instance name in the Property inspector.
3 Choose Window > Actions to open the Actions panel if it is not already visible.
4 In the Actions toolbox, click the Actions category, click Variables, double-click set variable, and name the variable _root.status. Then select the Expression check box for Value and enter the following code in the Value text box:
hitTest(_root._xmouse, _root._ymouse, true)
Flash automatically adds the onClipEvent handler.
5 Highlight the onClipEvent action and select enterFrame as the event.
6 Choose Control > Test Movie and move the mouse over the movie clip to test the collision.
The value true is displayed whenever the mouse is over a nontransparent pixel.
"A day without laughter is a day wasted." - Charlie Chaplin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|