Skip to main content
texjgc
Known Participant
February 22, 2008
Question

need MC to disappear on rollout

  • February 22, 2008
  • 5 replies
  • 417 views
Hello.

I am trying to have my custom cursor become invisible when the user rolls out of the SWF clip.

Im using this code and its not making the custom cursor invisible when the mouse is rolled off the flash movie. If anyone can tell me what is wrong here I would appreciate it greatly. Basically the setup is a flash SWF in the middle and HTML graphics on the sides and when the user rolls out of the SWF boundaries the custom cursor is supposed to disappear or become transparent untill the user rolls back over the SWF.

Thanks for the help.

So far Im using the following code:

This topic has been closed for replies.

5 replies

Venian
Inspiring
February 24, 2008
Yap. You can't activate stopDrag triggering the cursor_mc. Draw a rectangle as big as the stage (same dimensions), with no border and set the fill any color with alpha 0%. Center it to the stage. Name it let's say over_mc.

cursor_mc._visible = false;

over_mc.onRollOver = function() {
Mouse.hide;
cursor_mc._visible = true;
cursor_mc.startDrag();
};

over_mc.onRollOut = function() {
Mouse.show;
cursor_mc._visible = false;
cursor_mc.stopDrag();
};


There are plenty of ways to do it. This is one. Depdends on what do you need it for. This might not be a good solutions for your problem. As i said: depends on what do you need it for.
Inspiring
February 24, 2008
If cursor_mc is the custom cursor I don't believe you can detect a rollout while you are still dragging it.
Try adding a trace here and see if it is printing.

cursor_mc.onRollOut= function() {
//add trace here
trace("this is roll out");
this.stopDrag();
if (this.hitTest(_root)) {
this._alpha = 0;
}
};

If this is the problem put your hit test inside of a onMouseMove

Hope this helps
texjgc
texjgcAuthor
Known Participant
February 24, 2008
Anyone else know a remedy to this issue?
texjgc
texjgcAuthor
Known Participant
February 22, 2008
Thanks for the reply. I appreciate your help.

I just tried it, but it didnt work. :-\

Heres the error I got;

**Error** Scene=Preloader, layer=Cursor, frame=1:Line 3: Statement must appear within on/onClipEvent handler
import mx.transitions.Tween;

**Error** Scene=Preloader, layer=Cursor, frame=1:Line 4: Statement must appear within on/onClipEvent handler
import mx.transitions.easing.*;

**Error** Scene=Preloader, layer=Cursor, frame=1:Line 6: Statement must appear within on/onClipEvent handler
Mouse.hide();

**Error** Scene=Preloader, layer=Cursor, frame=1:Line 7: Statement must appear within on/onClipEvent handler
this.startDrag(true);

**Error** Scene=Preloader, layer=Cursor, frame=1:Line 10: Statement must appear within on/onClipEvent handler
cursor_mc.onRollOut= function() {

Total ActionScript Errors: 5 Reported Errors: 5
February 22, 2008
Im not sure if this is completely correct.... but it is something you could try...

It uses the Tween Class in Flash to alpha fade your stuff

HTH,

Doug