Solved

Keep Custom Cursor At the Highest Depth

Posted on 2010-09-12
4
390 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
ID: 33659983
walker are you trying to do this in AS2 or AS3?
0
 
LVL 3

Accepted Solution

by:
cconstable_work earned 250 total points
ID: 33660030
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
ID: 33686448
This works, except that I can't click on anything.
0
 
LVL 3

Expert Comment

by:cconstable_work
ID: 33687167
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

806 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