ActionScript 3.0 :: Preventing Listener On Parent MC From Trigerring?

Jun 30, 2011

I've got a container movieClip called 'parentMC' with the following event listeners...

parentMC.addEventListener(MouseEvent.MOUSE_OVER, over);
parentMC.addEventListener(MouseEvent.MOUSE_OUT, out);
parentMC.addEventListener(MouseEvent.CLICK, click);

Inside 'parentMC' I have a button called 'childMC'. On childMC I have the following three listeners also:

childMC.addEventListener(MouseEvent.MOUSE_OVER, over);
childMC.addEventListener(MouseEvent.MOUSE_OUT, out);
childMC.addEventListener(MouseEvent.CLICK, click);

Basically I don't want the MOUSE_OUT and MOUSE_OVER functions of the parent being triggered whenever I mouse over the childMC inside of it. Is there any way to prevent this?

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Access The Parent Of A Listener From A Listener Object?

Feb 11, 2008

I am having a weird problem with scope/reference. I am using a loop to preload a number of thumbs in one go, I am creating a different listener for each one on the fly and then passing event handlers for each one of them. This should not be difficult using a loop, but somehow I cannot access the the parent object on my listener and therefore I can't do much with my thumbs after they are loaded.Here is the relevant segment of my code. myThumb_mc is a temporary variable that does not exist when the loop finishes, you can copy and paste this code to test it though. It should work to that extent. (you'll need an image1.jpg to be in the same directory)

Code:
var myThumb_mc = _root.createEmptyMovieClip("myThumb_mc", _root.getNextHighestDepth());
myThumb_mc.clipLoader = new MovieClipLoader();
myThumb_mc.clipLoader.loadClip("image1.jpg",myThumb_mc);[code].....

The code above works, but it does not look nice and it cannot be the right way of doing this. Long question short, how can I access the parent of a listener from a listener object? ._parent does not work.

View 9 Replies

ActionScript 2.0 :: OnRollOver Event Of Parent MC Preventing OnRollOver Of Child

Oct 18, 2007

I have a movieClip, which in turn has a nested movieClip. I need each of these to have thier own onRollOver events, the parent movieClip is OK, but the event never fires for the nested movieClip. My code goes something like this:

[Code]...

is output when mcOne is rolled over, as it should, but nothing is output when mcTwo is moused over.

View 2 Replies

AS3 :: Let Event Listener In Loaded SWF Catch Events From Parent SWF?

Jun 21, 2011

This isn't an exact duplicate of AS3: add event listener to loaded swf, actually it seems to be a mirror situation with non-mirror solution..

I have a test flash file that registers its own listener at first frame's actions.

trace("it's going to be OK");
stage.addEventListener(KeyboardEvent.KEY_DOWN, aKey);

Unfortunately neither line works when .swf is loaded into another movie. Assuming that stage object is wrong for such situations, which object should be used to get listener?

Is it necessary to rewrite loader in parent swf, as said in the linked question?

View 1 Replies

ActionScript 3.0 :: Child Label Re-triggering Parent Listener

Jan 25, 2012

I am trying to create a project where I have a homemade button with a label component inside converted to a MovieClip. I have added an event listener, which triggers successfully when I move into the MovieClip, but retriggers when I move into the label within the MovieClip. Is there anyway to tell it to stop retriggering and act as a single MovieClip, or would it be simpler to break down and just try to customize the Button component?

Here is a sample of what I'm trying to do:

Code:
import flash.events.Event;
btBox.addEventListener(MouseEvent.CLICK, funcClick)
btBox.addEventListener(MouseEvent.MOUSE_OVER, funcClick)
btBox.addEventListener(MouseEvent.MOUSE_OUT, funcClick)

[Code]......

Notice how it thinks I mouseOut of btBox when the mouse went over the label, and went back to the btBox after I left the Label.

View 4 Replies

ActionScript 3.0 :: Adding And Event Listener To Somethings Parent?

Oct 21, 2010

I'm trying to add an event listener to something that lives on the parent level of the function that runs.This is what I have in a function -

Code:
MovieClip(parent).footer.addEventListener(MouseEvent.CLICK, footerOpen);Here's the error that it's throwing.

View 5 Replies

ActionScript 3.0 :: Registering (grand)children Dispatchers With A Parent Listener

Sep 3, 2008

I have a Document class called Main.

As a child of Main, I have an instance of a class called NavMenu.

As children of NavMenu, I have multiple instances of a NavLink class: navLink01, navLink02, navLink03, etc.

Back up in the Main class, there is a function called navigateTo, which accepts sectionID variable as an argument.

My question is, what is the best practice to get the navLinks to call the navigateTo function on Main? I've been told that in the spirit of encapsulation, it is not best to pass a reference to Main down to the navLinks, and call the function from there.

But rather, it is desirable to use the event listener/dispatcher method, where the navLinks are dispatchers, while the Main class listens for the navLinks to broadcast their sectionIDs.

While this makes sense, however, don't you still have to pass a reference of the listener on the Main class down through the hierarchy, so that the navLinks are registered as dispatchers? Doesn't that defeat the purpose of encapsulation?

View 4 Replies

ActionScript 3.0 :: Remove Event Listener From Child Inside Parent MovieClip?

Mar 13, 2011

I have created event listeners for a particular movieclip.Insidet this movieclip there is so many objects.When ever I click on the parent movieclip the event listener calls the function for the child object. I had tried removeEventLIstener()

import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
var info:MovieClip=new MovieClip();
info.graphics.beginFill(0x000000,0.35);
[Code] .....
I want to delete mc's parent

View 2 Replies

ActionScript 3.0 :: Add Event Listener On Parent For Event.target = Child?

Jul 30, 2009

I have these buttons in a movie clip and I would like to have only one event listener for the parent, using event.target to point to the children. I have also tried event.currentTarget, and it didn't work.here is the code that works:

test01.abtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.bbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.cbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);[code]....

It is only targeting the movie clip, not the buttons inside the movie clip.

View 4 Replies

ActionScript 3.0 :: Positioning Parent MC In Order To Center Child MC On Parent's Parent MC

Feb 5, 2010

[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]

View 2 Replies

ActionScript 3.0 :: Remove Parent.parent.parent Child?

Jan 3, 2010

I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()

View 1 Replies

ActionScript 3.0 :: Referencing Stage - Add Bullets To The Stage Rather Than Using Parent.parent.parent.addChild?

Jul 10, 2009

I'm currently making a platform game and when the player shoots i want to add the bullets to the stage. The players gun class is in charge of adding bullets. The "players gun" is a child of "players gun holder" which is a child of "player" which is a child of the stage. is there a better or more dynamic way for the "players gun" to add bullets to the stage rather than using parent.parent.parent.addChild (bullet);

View 2 Replies

ActionScript 3.0 :: Event Listener - Error #2007: Parameter Listener Must Be Non-null?

Feb 4, 2009

this is the error I am having:

TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/removeEventListener()
at project1_fla::MainTimeline/btnName()

here is my code:

ActionScript Code:
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;[code]..........

View 1 Replies

AS2 :: IDE - Stage.width Listener - Trace The Results Of Listener When The Browser Is Resized

Apr 13, 2009

Line 1 Frame 1:

[Code]...

I am trying to trace the results of my listener when the browser is resized...no avail. Are you able to see what I am doing wrong?

View 1 Replies

ActionScript 3.0 :: Screenshot Preventing In Flex?

Mar 9, 2009

I'm developing some photo viewer app for some web site in flex 3. One of the demands made by my customers is preventing of their unique visual content from copying at least by standard Windows tools ("Print Screen" button). Are there any tricky techniques capable of doing this?

The first thing occurred to me is handling "Print Screen" button of keyboard doesn't seem to be as effective as my client needs.

View 2 Replies

ActionScript 1/2 :: Preventing Concatenate Using '+' Operator

May 27, 2009

How can I prevent concatenating when using the addition operator? totalCost_txt.text = (firstCost_txt.text + secondCost_txt.text)I can replace the "+" with any other operator and it works. (huh?)

View 3 Replies

Professional :: Preventing IPhone From Going To Sleep?

Jan 15, 2012

I stayed up all night building an application on cs5.5 that needs to keep running for up to an hour without the screeen dimming or the device going to sleep. After a lot of googling I could not find anything. Is there a way to emulate or trick the system and make it think that there is user interation ? Or is there an option I can change to make this work? I am testing on an ipod touch 4g

View 3 Replies

Java :: Preventing Flooding/DOS Attacks In AMF App?

Aug 15, 2011

I'm working on the Java backend for a Flash webgame - the client and server communicate using Action Message Format (AMF). A few weeks ago, another team in our company had their product hacked by a user who decompiled the Flash client, and used an altered version to flood the backend with bogus requests. We want to prevent this kind of attack in our new game.(More details: webserver used is Tomcat, AMF client is BlazeDS.)I'd like to know what the best way to prevent this kind of attack would be. Some ideas I had:the nginx configuration seemed like the best place to handle rate limiting, but I cant find any resources on how nginx interacts with AMF. Do the AMF requests just get sent straight to Tomcat?most requests involve a userId param for the relevant user. Rate-limiting requests involving overused userIds might be one approach - however, an attacker who just wants to flood the server could easily spam random userIds.

View 1 Replies

ActionScript 2.0 :: Preventing Swf Files From Decompiling?

Sep 10, 2009

What is the best way for preventing swf files from decompiling?

View 1 Replies

Preventing The OnRollOver Durring The OnRollOut

Jul 22, 2009

This may be simple. All i want to do is prevent the onRollOver event from firing while the tween for the onRollOut event is playing.

View 1 Replies

ActionScript 2.0 :: Preventing Video Playback?

Mar 12, 2008

I imported a video using progressive download method (so not embedded). I don't want the video to play until the user clicks on it. Right now, it's playing as soon as I get to the frame it's on. Is there a way to prevent it from playing until the user activates it?

View 3 Replies

ActionScript 3.0 :: TimerEvent Preventing A GotoAndPlay?

Sep 7, 2009

I have a movie clip, asterixHolder, with multiple frames that is instructed, at times, to gotoAndPlay at a particular frame (where'currentSection' is a number):

Code:
asterixHolder.gotoAndPlay("tween"+currentSection); Nested inside asterixHolder is a clip called theAsterix that I want to continually rotate. I've been achieving this with a Timer Event:

[Code]...

However, when the TimerEvent code is included - or to be more precise, when the function timerHandler references asterixHolder - the previous code to send the clip to the appropriate frame does not work. Could anyone tell me why this is the case? It doesn't seem logical that calling a nested clip should prevent the parent clip from doing anything.

View 2 Replies

IDE :: Preventing Flash Player Caching

Sep 8, 2009

edit: Resolved; my ActionScript function for parsing the mySQL results didn't correctly interpret a recently modified column, and the corrupted new output happened to be identical to the old output.

I have created an application that accesses a PHP/mySQL database, but it caches old information.

I used the workaround from Adobe's website, where I append '+ new Date().getTime()' to the URLRequest String, but the application continues to use the old data.

When I trace the URLRequest String and C&P it into a browser window, however, I receive the correct data.

View 2 Replies

ActionScript 3.0 :: Preventing Event Dispatch?

Feb 14, 2010

I have a class that extends the MovieClip class, is there a way that I can prevent this MovieClip from dispatching a certain event? More specifically I want to prevent it from dispatching MouseEvent.CLICK under certain conditions.

View 5 Replies

ActionScript 3.0 :: Preventing Overlap On Hit Test?

Oct 13, 2010

I have two rectangles, one of which is draggable, and when hitTestObject occurs I want to prevent the overlap.

here is the code:

addEventListener(Event.ENTER_FRAME, detectColl);
redSquare.addEventListener(MouseEvent.MOUSE_DOWN, grabIt);
redSquare.addEventListener(MouseEvent.MOUSE_UP, dropIt);

[code]....

View 2 Replies

ActionScript 2.0 :: Preventing From Going Full Screen?

Dec 3, 2003

whenever i view my animaion on my browsers, it plays to fit the screen. actionscrip that will keep it the size it is meant to be. And if the actionscript has to be added to the first frame..does that mean to every layers first frame(there are about 6 or 7 layers)..one more thing..with the animation already done, how can i insert a preloader all the way in the begining?

View 2 Replies

ActionScript 3.0 :: Add A Clip To The Stage As A Child And Remove The Parent And Set The Parent Equal To Null?

Sep 11, 2010

if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child? 

In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.

If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.

View 29 Replies

ActionScript 3.0 :: Error 1120: Access Of Undefined Property Parent + Movieclip(parent)?

Mar 15, 2011

I am trying to access a function that is on my document class for my AS3 project, from a nested class. That is, the Document Class calls Class A which then calls Class B. So I am trying to access a function from Class B, I am trying to use MovieClip(parent).function(); but I am getting error 1120. The MovieClip(parent) (fixed to reflect my document class, etc) works when I try it from other classes but not from this nested class.

View 9 Replies

Flash :: Drag And Drop Application Where Mc Is Dragged Out Of One Parent Mc And Dropped Into Another Parent Mc?

Nov 13, 2010

Simple drag and drop application where mc is dragged out of one parent mc and dropped into another parent mc.All works OK until I added 2 text boxes to the mc's -- one is a non-selectable dynamic text box (a label) which is set by the code, the other is selectable input text that the user can amend.

Finger cursor disappears when user hovers over the section of the mc that contains the text fields (even non-selectable text??) When the user trys to drag the mc by inadvertantly click-dragging anywhere within both text areas it causes this error: TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@2374a381 to flash.display. MovieClip (same error appears for both text boxes)

The input text box may confuse the user - how do they sometimes click to drag and sometimes click to amend? I need to create an overlay area within the mc that is click-detected for the drag? Here's the relevant bits of code:

var itemArray:Array = [
{iname:"police",ititle:"POLICE OFFICER"},
{iname:"insurance_assessor",ititle:"INSURANCE ASSESSOR"},[code].............

View 1 Replies

ActionScript 3.0 :: Tab Indexing Loop Through Parent, External Child Swf, Back To Parent?

Nov 11, 2009

I have a parent swf which loads many child swfs (though only one is displayed at a time). My intention was to use the loaded SWFs document class to retrieve an array of objects to be assigned a tab index, combine this with the parent's own array of objects and apply sequential tab indices to them all. But what happens is actually that the parent's objects are assigned an index, but the external swf is unaffected. In fact, the external swf retains its automatic tab indexing, when I would expect that having set a value for InteractiveObject.tabIndex, automatic tab indexing would be disabled.

I've seen similar tales elsewhere. Most posts I've read are wanting to load an external swf, give it focus and loop through those objects, then close the swf and return to looping through the parent. However I would like loop through all objects as one. including manipulating the focus manager(s), and basically fiddling with every tab-related property I know.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved