We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

movieclip within movieclip click through problem

guswebb
guswebb asked
on
Medium Priority
456 Views
Last Modified: 2013-11-11
I have 2 movieclips, MC called A is a big MC ontop (in layer) of a MC called B. Say MC A is about 2x bigger than B. Ultimately what i would like to do is make the big MC non-clickable but have a rollOver and rollOut function (but i dont want the hand cursor to show over MC A). MC B is going to be the clickable area and when i click on it it will make MC A disppear (i.e. sets MC A = _visible = false). The code is what i have so far but doesnt work.
Screenshot shows 3 MCs, MC A that im describing and 2 others of which 1 is MC B, you can just ignore the other one.
mc1_mc.useHandCursor = false;
mc2_mc.useHandCursor =  true;
 
mc1_mc.onRollOver = function()
{
}
 
mc1_mc.onRollOut = function()
{
}
 
 
mc2_mc.onMouseDown = function()
{
	if (this.hitTest(_root._xmouse, _root._ymouse, true))
	{
			trace("im clicked")
			this.swapDepths(this._root.mc1_mc);
			_root.mc1_mc.swapDepths(-100)
			this.swapDepths(10)
			mc1_mc._visible = false;
			mc2_mc.useHandCursor =  true;
	}
 
}

Open in new window

untitled.PNG
Comment
Watch Question

which part of the script does not work.

because everything seems to work except the useHandCursor method

however the useHandCursor is only meant to be used on buttons and not

movieClips.

GE

Author

Commented:
Well what i want it to do is as follows:
Only when i hover on the small block behind the big block do i want the cursor to appear and then when i click on that same block i want the big block to disappear while the hand cursor remains existant on the small block. If you notice from my code, it does not do this. And i didnt know you could only use it on buttons because the documentation says its for movieclips.useHandCursor.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Commented:
GE thx for that example although in your example youve placed the green layer behind the front layer. In my example i need the big green layer to be infront of the gray one. The idea is as follows:
I want to be able to hover over the green area fine but if i click on the green area where the gray area exists underneath then the gray area should indicate it was clicked.
I think i have found a solution though:
greenArea.onRollOver = function()
{
      this._parent.gotoAndStop(2);
}

greenArea_mc.onRollOut = function()
{
      this._parent.gotoAndStop(1);
}

grayArea.onMouseUp = function()
{
      if (this.hitTest(_root._xmouse, _root._ymouse, true)) // mouseClick was within grays region
      {
            // gray MC in layer behind Green one was clicked :)
      }
}

If you have anything better by all means let me know otherwise thx for ya help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.