ActionScript 3.0 :: Get InstanceName / Object From MouseEvent.target?

Jun 4, 2009

[Code].....

When Mouse is down on PlanetEarth_mc, only PlanetEarthOuter_mc starts moving, leaving PlanetEarthInner_mc and PlanetInner_txt in the same existing place. I want to call the parent of the target i.e. I want to move PlanetEarth_mc. also, EventReceived.target.parent.startDrag();//Gives Error. How can I achieve that from received MouseEvent Object I hope u understand this.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: MouseEvent Target MouseEvent RelatedObject?

Jul 24, 2009

I have the following:
 
rwBtn.addEventListener(MouseEvent.MOUSE_OVER, audioOver);
function audioOver(e:MouseEvent):void
{
var thisClip:MovieClip = e.relatedObject;
thisClip.alpha = 0;
}
 
I would like to change the alpha of the clip that is being rolled over. I don't know how to target the clip that is being rolled over. How do I do that?

View 3 Replies

ActionScript 1/2 :: Set The UIScrollBar Object(instancename) Scroller At The End?

Oct 30, 2010

this is my Code

[Code]...

View 2 Replies

ActionScript 3.0 :: Finding The Target Of A MouseEvent?

Jul 2, 2010

I have an object (a Loader) that you can click on, resulting in a MouseEvent. Clicking on the Loader moves it, which I do by modifying e.currentTarget.x in the MouseEvent function, a la:
   
private function onClick(e:MouseEvent):void {
e.currentTarget.x = 0 - (e.currentTarget.width/2);
}

The problem is, I also want to change the ChildIndex of the target. I tried this:

private function onClick(e:MouseEvent):void {
e.currentTarget.x = 0 - (e.currentTarget.width/2);
canvas.setChildIndex(e.currentTarget, 10);
}
 
But that results in a compile error: "Error Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. at line 85 in Rotation.as"
 
I've noticed that sometimes I need to refer to the target as e.currentTarget.loader, so I tried that (canvas.setChildIndex(e.currentTarget.loader, 10);), but I get an error when I run it: "ReferenceError: Error #1069: Property loader not found on flash.display.Loader and there is no default value. at Rotation/onClick()". What's the proper way for me to get the target so I can apply setChildIndex?

View 2 Replies

ActionScript 3.0 :: Detect If The Target Of A Mouseevent Is A Child Of A Movieclip?

May 29, 2010

I have a parent movieclip with a few other movieclips inside it. When I add a mouseclick eventlistener to the stage and click on one of the children, i want the target of the event to be the parent movieclip. I still need the children to be mouseEnabled.

how do you check if a movieclip is a child of another?

View 9 Replies

Flash :: Get The MouseEvent.localX And LocalY Of A Target But Not Its Child Objects?

Jul 24, 2009

I'm creating a simple drawing application that adds new Shape objects to a MovieClip "canvas" every time the user clicks and drags. The problem is, I'm noticing that even though the MouseEvent listeners are set to the MovieClip, the child Shape objects are being returned as targets as well. This disrupts the localX and localY as well, causing the drawing cursor to jump around as the coordinates change from being local to the entire MovieClip to local to the Shape the mouse is currently over.Is there any way to retrieve the most parental target from a MouseEvent?

View 1 Replies

ActionScript 2.0 :: Stop The Object From Dragging When The Object Was Already Dropped To Its Target ?

Dec 27, 2011

how can i stop the object from dragging when the object was already dropped to its target =)

here is my code :

var pointsCtr:Number=0;
s1_mc.onPress = function()
{
s1_mc.startDrag(false);

[Code].....

View 3 Replies

Actionscript 3 :: Use MouseEvent For Getting Object`s Public Variables?

Sep 5, 2011

I have a simple problem which is not easy at the moment. this is a text field class which add a text field to a movieclip (passed from root class) and also save(buffer) some data (like xml file name) in it`s public variables:

package src {
import flash.display.Shape;
import flash.display.MovieClip;[code]............

.. now I use a for loop to add instance of that class to a movie clip on stage:

for (var i:int = 0; i<Bunker[0]["trans0size"]; i++) {
menuData[i] = new menuitem00(i, menu_mc, Bunker[0]["transfile0" + i]);// pass i , a movieclip named menu_mc and an xml file name
menuData[i].name00 = Bunker[0]["transtitle0" + i]; // pass text
menuData[i].activateFlag = true; // set actveFlag to true
menuData[i].init(); // run init() inside the instance. it adds textfield to the menu_mc and also set name00 as Text for the textField
}[code].........

I want to get "xml00" var from that instance on the stage by mouse click but, trace (evt.target.xml00); is not working .. also trace (evt.target.name00); is not working. I can get everything like .alpha or .text from txt00 but not other variables in my object.

View 1 Replies

ActionScript 3.0 :: MouseEvent CLICK And DOUBLE_CLICK On Same Object

Jan 8, 2008

how to listen on a SINGLE CLICK as well as DOUBLE CLICK for an object?

Meaning, one behaviour if the object is single clicked and another behaviour if it is double clicked.

Simply adding two event listeners (CLICK and DOUBLE_CLICK) leads to CLICK handler getting called always.

I understand one could start a timer upon the CLICK and if another CLICK doesn't arrive within 'x' milliseconds generate a SINGLE_CLICK event, else generate a DOUBLE_CLICK event. It seems like a hack and dependant on CPU load.

View 14 Replies

ActionScript 2.0 :: Return The Target Of A Tween Object From Within The Object?

Nov 7, 2006

Is there a way to return the target of a Tween object from within the object?

Code:
myTween.onMotionFinished = function (){
trace (this.target)
}

That's obviously not the way you do it, but that's what I want it to be...

View 9 Replies

Actionscript 3.0 :: PV3D - MouseEvent.CLICK On Object Instead Of Face

Feb 10, 2009

I've created 4 cubes, which turn on Rollover and Rollout, and on Click they should move to new x y coordinates.The Rollover and out on the faces (workfront,workback) work fine, but i don't get it right to put the Click on the whole cube.if tried to address it with workcube.addEventListener(MouseEvent.CLICK, workclick); but that doesn't work.if i address it with this or without workcube all my cubes react to the click

Code: Select allvar workcube:Cube = new Cube(new MaterialsList({front:mat2, back:mat3, top:mat0, bottom:mat0, left:mat1, right:mat1}), 60,60,60,10,10,10);
scene.addChild(workcube);

[code]....

View 4 Replies

ActionScript 3.0 :: MouseEvent.CLICK And Visibility Of Sprite Object?

Jun 24, 2009

Here, my loader instance name is: myLoader.  When I click on the dynamically loaded image, I need to place a small red rectangle at that particular pixel position on the image.For creating a small rectangle, I am using following code:

[Code]...

View 2 Replies

Flash :: AS3 MouseEvent.MOUSE_MOVE Event Stops Responding After MouseEvent.CLICK Call?

Nov 6, 2010

I have several stage event handlers to enable mouseovers over several dynamically generated moviecilps on the stage that then change their alpha to indicate the mouse is over that particular mc... fairly trivial (mcOver handler). Additionally, I also want to know what MC is clicked, so I update a public variable (public var activemc:Number) with the ID of the dynamic movieclip when the mouse is over it (using a hitTest to check, which is why the EventListener is added to stage and not to the MC), which is checked in the mcClicked handler:This is in the constructor:

//stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);[code]....

However, the mouseover behaviour (alpha 0 when over, alpha 1 when out) stops working as soon as I click on any movieclip on the stage, and the mcClicked ID checking (below) stops working completely. I don't know if this is to do with focus:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
}

I then tried adding the event handler for the stage mouse_move again and this gets the mouseover working again but only for 1 more click, after which it stops again:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);

View 1 Replies

ActionScript 3.0 :: Get MouseEvent.ROLL_OVER Or MouseEvent.MOUSE_OVER To Pass Through To MovieClip Underneath

Jul 9, 2009

I have a MovieClip (call it base_mc) which is under a bunch of other MovieClips (call them subclips). The MovieClips on top are all mouseEnabled with MOUSE_OVER, CLICK, etc, event handlers. I want to capture the event of MOUSE_OVER (or ROLL_OVER) on the base_mc as well. Any time I am over one of the subclips I am also over the base_mc clip. How can I capture this event?

View 2 Replies

ActionScript 3.0 :: Flex - Diffrence In MouseEvent.CLICK & MouseEvent.MOUSE_DOWN?

Oct 21, 2010

I'd like to know what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN. Because when i use MouseEvent.MOUSE_DOWN for a button to set full-screen view its doesn't work, instead of this MouseEvent.CLICK works. So what was the reason.

View 3 Replies

ActionScript 3.0 :: MouseEvent.MOUSEDOWN Works But MouseEvent.CLICK Doesn't

Nov 6, 2010

I'm making a button for the first time, and I wanted to use a full click to drive it. However, when I use addEventListener(MouseEvent.CLICK, onClickHandler); nothing happens when I click on it. When I use (with the rest of the code being identical) addEventListener(MouseEvent. MOUSE_ down, onClickHandler); it works like a charm.

View 6 Replies

ActionScript 3.0 :: Dragging Object Interfering With MouseEvent.CLICK Function

Oct 3, 2009

I am having a small problem in regards to a click and drag interface I am trying to create.

The user should be able to drag objects around the stage and when desired click to preform an animation.

The problem is that the click to initiate the drag also initiates the click of the animation to play.

I don't really want to make one of the commands a double click as that may feel clunky to some users.

Is there any way to cancel the animation click if the user moves the mouse before letting go?

View 0 Replies

ActionScript 3.0 :: Difference Between MouseEvent.MOUSE_UP And MouseEvent.CLICK?

Apr 7, 2009

What is the difference between MouseEvent.MOUSE_UP and MouseEvent.CLICK? Why should I use one of these over the other? 

Code:myButton_btn.addEventListener(MouseEvent.MOUSE_UP, fNavigate, false, 0, true);
myButton_btn.addEventListener(MouseEvent.CLICK, fNavigate, false, 0, true);

View 3 Replies

Actionscript 3 :: Cancelling MouseEvent.CLICK After MouseEvent.MOUSE-DOWN

Aug 11, 2011

I have a MOUSE_DOWN handler that creates a CLICK event listener on a child object. Naturally, as soon as you release the mouse button, if you happen to be over the child object, the CLICK event fires.I was disappointed to discover that event.stopImmediatePropagation doesn't interrupt the CLICK event from registering the MOUSE_DOWN as part of its detection cycle. It makes sense that it doesn't but still... disappointing.A MouseEvent.CLICK consists of detecting a MOUSE_DOWN on the object and then if it's followed by a MOUSE_UP without leaving the object, he event fires. I had hoped that by cancelling the MOUSE_DOWN event, it would clear that out of the CLICK buffer, but no such potatoes, alas.This could all be handled with a flag and a couple more MOUSE_UP and MOUSE_DOWN handlers, but dang, smacks of effort

View 2 Replies

Get InstanceName By String?

Aug 16, 2011

In Objective-C how to get instance name by certain rules?[code]...

View 2 Replies

ActionScript 3.0 :: MovieClips Won't Hold Instancename

Jun 22, 2010

This seems so simple and yet I can't figure out why my MovieClips won't hold their instance names.[code]And I do this for each button (I know I can do this with XML but nothing seems to work right now so I've broken it all down to see what's going wrong).[code]And the trace statement gives me "instance29" or some such. Can't seem to get the name to stick. I've tried creating getter and setter methods in my button class to access a label property and use that instead of the name but it comes out undefined when I trace. I'm having trouble finding anything on the forums though I'm sure it must be there. Could someone point me in the right direction. I don't need a full answer, just an explanation of why this is happening.

View 2 Replies

ActionScript 2.0 :: Drag Dymanic InstanceName MovieClip

Jan 19, 2011

i need to assign an instanceName to a dynamic movieClip and I get it! But, the drag & drop functions aren't works properly..the code:[code]

View 8 Replies

ActionScript 2.0 :: Passing InstanceName To CreateTextField Function?

Feb 17, 2012

createTextField function has the following signature:createTextField(instanceName:String, ...)it's ok if the instance name is passed as a string literal.but it does not recognise it if it is passed as a name of the variable containing this string:

createTextField("name_of_the_textfield", ...) is OK
name_of_the_textfield.type="input";
trace(name_of_the_textfield.type) returns "input"

[code]......

View 2 Replies

ActionScript 2.0 :: Lock Instancename For Working In Current Swf

Mar 3, 2005

Is there a way to lock instancename in a swf to prevent it conflict with other swf, when they are loaded in mainmovie.

Say I have this string: in both b.swf and c.swf. And they are loaded up at the same time in a.swf.

loadMovie(this.pathToPicsJan+this.pArrayJan[0], _root.photoJan);

Somehow the mainmovie get confused with the instancenames. Is there a way to get around with this so I don't have to rename each name?? It would b such a hassle to rename all instancenames if I got many duplicated/similar swfs.

View 2 Replies

ActionScript 2.0 :: Function That Works For Every Movieclip Whatever Instancename The Moviecl

Jan 21, 2007

I want a function that makes every movieclip on the scene thats beeing released to do what�s in the actonscript.My function doesnt woork, is there a function that works for every movieclip on the scene whatever instancename the movieclip has ?

Code:
movieClip.onRelease = function() {
this._alpha=50;
trace(YEAS);
}

View 1 Replies

ActionScript 2.0 :: Set More Than One Object In Single Target?

Dec 24, 2010

In my attached file first user drag dot symbol into the block targets and then user drag the arrow in the same targets.now i want to set both are in single target.( see the screen shot of target.png file )

View 0 Replies

ActionScript 3.0 :: Get The Target Object With TweenMax?

Jun 17, 2011

i'm pretty new user with TweenMax and i have simple question. Usually using flash built-in TweenEvent i could get the object that is tweening, using e.target.obj. But then apparently i couldn't do it if i use Greensock TweenEvent, because it seems unable to retrieve the object as the property "obj" could not be found.

What should i write that is equivalent to "e.target.obj"?

View 3 Replies

ActionScript 3.0 :: How To Undrag Object From Target

Mar 12, 2012

How do u undrag a object from the target in AS3?

View 2 Replies

ActionScript 3.0 :: Create New Object From Evt.target?

Sep 8, 2009

I want to do somthing like this:

Code:
function createObject(evt:Event):void
{

[code].....

View 8 Replies

ActionScript 2.0 :: Target Element Of Array From XML Object?

Apr 25, 2009

Down the end of the code I try to trace(english[j] but with undefined the result. However I can trace(english). How comes I can't target an index.

function Article(imagen, sonido) {
this.imagen = imagen;
this.sonido = sonido;

[code]....

View 4 Replies







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