Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-01-2012, 08:32 PM   #1
Scearezt
Satisfied User
 
Scearezt's Avatar
 
Join Date: Jun 2010
Location: C:\\System32\Hungary
Posts: 426
Default Child mouseEnabled

There is a main CONTAINER which contains a lot of other movieclips, in these CHILD1 movieclips, there are a CUBE and an IMAGE movieclip too. I want to disable the mouse events for only the IMAGE movieclip, is it possible?

ActionScript Code:
CONTAINER  -CHILD1   -CUBE //this has mouse events!   -IMAGE //want to disable the mouse events for this!  -CHILD2   -CUBE //this has mouse events!   -IMAGE //want to disable the mouse events for this!  -CHILD3   -CUBE //this has mouse events!   -IMAGE //want to disable the mouse events for this!
[IMAGE]
[[CUBE]]
[IMAGE]
[CUBE]
The image is bigger than the [CUBE] so it's overlaps the [[CUBE]] which is above the [CUBE], any idea?
Scearezt is offline   Reply With Quote
Old 08-01-2012, 09:48 PM   #2
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,332
Default

MouseEvent listener is registered with container, with capture set to true.
The click handler is called when the area over a cube is clicked.

instance names used in this code:
container, child1, child2, child3, cube, image

BTW, nothing but child MovieClips should be inside the container movieclip(!)
That means nothing whatsoever; no bitmaps, static text or decorative graphics. zip. zilch. nada.
Additionally, the instance names must all exactly match those used in the code, and each child must contain a cube and an image. Otherwise, this code will throw an error.
ActionScript Code:
import flash.display.MovieClip; import flash.events.MouseEvent; var num:int = container.numChildren; for(var i:int = 0; i < num; i++) {     var child:MovieClip = container.getChildAt(i) as MovieClip;     child.mouseEnabled = false;     child.image.mouseEnabled = false;     child.cube.buttonMode = true; } container.addEventListener(MouseEvent.CLICK, onClick, true); function onClick(e:MouseEvent):void {     trace("clicked " + e.target.parent.name + "." + e.target.name); }
[afz]snickelfitz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:22 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.