Solved

Keep Custom Cursor At the Highest Depth

Posted on 2010-09-12
4
370 Views
Last Modified: 2012-05-10
I'm adding a custom cursor, and I need it to stay at the highest depth. Currently, whenever I add new movie clips to the screen, the custom mouse shows up behind the movie clips, which looks terrible.  I have to add movie clips regularly during runtime, but I need the custom cursor to stay above them, just like the regular mouse would.

Here's how I'm adding the custom cursor:

                        Mouse.hide();
                  var cross= new crosshairs();
                  this.addChild(cross);
                  cross.depth = 999999;
                  cross.startDrag(true);
                       
0
Comment
Question by:walker6o9
  • 2
4 Comments
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
walker are you trying to do this in AS2 or AS3?
0
 
LVL 3

Accepted Solution

by:
cconstable_work earned 250 total points
Comment Utility
What version of Actionscript are you using?
You could:
this.addChildAt(cross, 0);

Then all other movie clips:
this.addChildAt(other_mc, 0);

this would ensure that the cross is continually pushed to the top when a new movie clip is added.

Or you could add a new container movie clip for your cursor and another container for everything else.

import flash.display.MovieClip;

var myMouseContainer:MovieClip = new MovieClip();
var myEverythingElseContainer:MovieClip = new MovieClip();
stage.addChild(myEverythingElseContainer);
stage.addChild(myMouseContainer);
var myCross:MovieClip = new cross_mc();
var myEverythingElse:MovieClip = new block_mc();
myMouseContainer.addChild(myCross);
myEverythingElseContainer.addChild(myEverythingElse);
0
 
LVL 1

Author Comment

by:walker6o9
Comment Utility
This works, except that I can't click on anything.
0
 
LVL 3

Expert Comment

by:cconstable_work
Comment Utility
Again not sure what version of action script you are using.
If you have a movie clip covering other movie clips and need to be able to click through it add:
my_mc.mouseEnabled = false;
this will stop the movie clip from being click-able which allows you to click things under it.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Flash doesn't load in Iphone and Ipad 22 472
Microsoft WSUS 4 82
EMET 5.2 / Adobe Flash 2 219
video live streaming 1 110
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now