Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Tips and tricks - MovieClip.mouseChildren

This is a discussion on Tips and tricks - MovieClip.mouseChildren within the Tutorials forums, part of the Flash English category; Here we are with a new tip of the day. After seeing the difference between target and currentTarget, after analysing ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 23-09-07, 11:50
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Tips and tricks - MovieClip.mouseChildren

Here we are with a new tip of the day.
After seeing the difference between target and currentTarget, after analysing the property dropTarget, today we will look at the property mouseChildren of the DisplayObjectContainer Class.
This property is used with MovieClip, Sprite, Loader and Stage.
Why???* Because, the DisplayObjectContainer Class is a super Class of Loader, Sprite and Stage.* It means that those classes inherit the methods and properties of the DisplayObjectContainer.* The MovieClip class, instead, is a subclass of Sprite so inherits its methods and properties from it.

What is so special about the mouseChildren?
Simple, it can help us resolve one problem.

As an example, let us say that we have a MovieClip containing more objects (ex: a text field) and that we want the mouse to interact with that MovieClip.
We add the needed listeners and realise that when the mouse is above the MovieClip it does not transform itself into the ‘hand’ pointer.* In fact, it would do so, only if the mouse is above one of the MovieClip’s object such as the text field.

Now, it is time to act on the property mouseChildren, the following way… I create a FLA and save it as ‘main.fla’.
Into which, I create a MovieClip on stage named ‘clip_mc’ which will contain a text field.

Now if I wanted to apply an event MOUSE_OVER to ‘clip_mc’, I will do as follow:
Code:
clip_mc.buttonMode=true;
clip_mc.addEventListener(MouseEvent.MOUSE_OVER,go);

function go(evt:MouseEvent):void
{
	// codice da eseguire
}





passing above the clip with the mouse, we realise that the mouse ‘hand’ pointer do not show until we are above the text field itself.
This is not the result we wanted.

To avoid that problem, we will use the property mouseChildren the following way:
Code:
clip_mc.buttonMode=true;
clip_mc.mouseChildren=false;
clip_mc.addEventListener(MouseEvent.MOUSE_OVER,go);

function go(evt:MouseEvent):void
{
	// codice da eseguire
}





See you next!
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Tips and Tricks - MovieClip.dropTarget Flep Tutorials 1 13-11-08 11:28
Problema con mouseChildren dierre FLEX builder 3 0 05-07-08 15:29
Tips abd Tricks Actionscript 3.0 - Loader.content Flep Tutorials 0 27-09-07 09:44
Tips and tricks - ghost instance Flep Tutorials 0 25-09-07 17:14
Trucco del giorno - MovieClip.mouseChildren Flep Articoli e tutorials 0 21-09-07 10:46


All times are GMT. The time now is 17:30.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap