ActionScript 3.0 :: StartDrag() Not Working For Child?

Jan 20, 2011

I have a movie clip that I want to drag, but it gives odd behavior. If I add the MC using:addchild(MC)it works fine. The problem occurs when I try to add it as a child of another MC:base.addchild(MC)When I do it like this the drag does not work (nothing happens). If I drag the parent, the child drags with it, but attempting to drag the child on its own does not work.  The function used is:

function pickUp(event:MouseEvent):void {
if (drawMode == NONE) {
event.target.startDrag();

[code]........

View 11 Replies


Similar Posts:


Actionscript 3 :: Flash - StartDrag() Within StartDrag() On Child MovieClip

May 19, 2011

as you can see, I have a container MC which I have added to the stage. I set its drag constraints using a Rectangle(). I then add the 'cat' child movieclip to the container, and I want this to be dragable too. However, as soon as I click on my cat when testing the MC. It shoots to point x=0 y=0 on the stage and doesn't move.

The container MC can be moved without any trouble.

If I remove the rectangle bounds from the containers startdrag() function. both MC's can be dragged without any issue.

//panning ability
my_x = 800 - myImage.width;
my_y = 480 - myImage.height;

[Code]....

View 3 Replies

AS3 :: Child Moves Parent Using StartDrag?

Nov 8, 2009

I have a MovieClip instance which can be moved around the stage using startDrag() and stopDrag(). The instance also has some child MovieClips using addChild(). The parent moves the children when dragging, which is fine. The children have there own startDrag() and stopDrag() which should apply only to the child object, however it also moves the parent and other children. When clicking a child the MouseEvent of the child is being called but so is the parent.

public class Component extends MovieClip {
private var nodes_array:Array = new Array();
public function Component() {
x = 60;

[Code]....

View 1 Replies

ActionScript 3.0 :: StartDrag In 3D Not Working?

Apr 1, 2010

The Language Reference states:
 
"Three-dimensional display objects follow the mouse and Sprite.startDrag() moves the object within the three-dimensional plane defined by the display object. Or, if the  display object is a two-dimensional object and the child of a three-dimensional object, the two-dimensional  object moves within the three dimensional plane defined by the  three-dimensional parent object."
 
However, this does not seem to be the case.  I have a 2D object which is the child of a 3D object, but startDrag will not work on the child.  If I remove any tweens in code from the parent's rotationY then startDrag will work.    If I have any reference to rotationY it will not work, even if it is set to 0.

[Code]...

View 4 Replies

ActionScript 3.0 :: Can't Get StartDrag Working

May 20, 2009

I have a MovieClip with other MovieClips inside of it. On each of the MovieClips inside, I have added a MOUSE_DOWN event and in the handler, I call e.target.startDrag(false, null);

But it doesnt seem to work :/

I have traced out the target name. I have tried current target and traced out it's name. THey both trace correctly. The target is being reached and it is the corect target. But the startDrag function doesnt make the MovieClip draggable.

View 6 Replies

ActionScript 3.0 :: StartDrag Not Working Within A Loaded Swf?

Oct 14, 2009

I'm trying to work with a movie clip that I am loading into my main SWF. When run alone the draggable rail works fine but once loaded into the actual main SWF it won't drag. I put an on EnterFrame on it so that when I click it reads out some data and that still works within the main swf. Is there some sort of restriction on what loaded content can do?

import flash.display.MovieClip;import flash.events.MouseEvent;
var upper_left = rail.x;var upper_top = rail.y;var travel = rail.height-handle.height;

[Code].....

View 12 Replies

ActionScript 3.0 :: Enterframe StartDrag Not Working With RotationX?

Jun 10, 2009

I created a full flash template website loading external swf's.Lately, I managed to add a fake3D rotation with AS3 and CS4 to this global template with enterFrame.Problem : some of my external swf use a vertical scroller also using an enterframe function based on a startDrag bar with the x / y position of the mouse, the scroller dont work anymore.

View 8 Replies

ActionScript 3.0 :: StartDrag() Not Working When Loaded Into A Bigger Movieclip?

Oct 8, 2010

I am working on a simple drag and drop game which works fine by itself.

But the problem is that when this slide is loaded into a bigger gameloader swf. The x axis does not update itself.

Thus when the draggerable gets drag, it moves in relative to gameloader's stage size instead of its own stage size..

Is there any ways that I can lock coordinates of the X and Y axis to that of the game instead of the gameloader?

View 0 Replies

ActionScript 3.0 :: Loaded External MP3 Player, StartDrag Not Working

Oct 23, 2010

all of the other buttons on an external movie are workign but the volume slider is not...

when i load the external file (the mp3 player) it works fine.

Code:
/* volumeStartDragging(event:MouseEvent):void
* Returns a mathematical value that we can use to adjust the volume
* the value is the relation of the volume ball to the line

[Code].....

View 1 Replies

Flash :: Canvas Moved On StartDrag() Without Calling Set X / Y Or Move() - How Does StartDrag() Exactly Work In As3 / Flex

Feb 11, 2011

i have an .as class that extends mx.containers.Canvas (it's a draggable border of a resizable component), it becomes draggable on MOUSE_DOWN and stops being draggable on MOUSE_UP, MOUSE_OUT and ROLL_OUT. before calling startDrag() i create a Rectangle to define the drag area, i also have a _dragging: Boolean variable to control if it's draggable at the moment. the problem is that when i click this border it jumps to a negative coordinate without calling startDrag or switching _dragging to true.

i've overriden get x, set x, get y, set y and move() methods in order to solve it but the only thing i got was the fact that position changes without calling coords setters or move(), but at the moment it's changed a getter is called and returns new (negative) value so my question is what happens on startDrag() and how to filter unwanted incoming coords values?

View 3 Replies

ActionScript 3.0 :: Access To A Child Not Working?

Oct 7, 2009

I am adding a movieclip in a class I will call class B that is added to a class I will call class A. In class B I am adding the movieclip like this:

var thumbHolder:MovieClip = new MovieClip();
thumbHolder.name = "thumb" + loadingCount;
MovieClip(root).slideMenuHolder_mc.slideMenu.thumbs_mc.addChild(thumbHolder);
trace("after: thumbHolder.name is: " + thumbHolder.name);

In class A, I can do something like this:
thumbs_mc.alpha = .3;
 
But if I try to do something like this, I get an error, even though the trace above traces out the names correctly. thumbs_mc.thumb1.alpha = .3;

View 6 Replies

ActionScript 3.0 :: Nested Add Child Not Working?

Dec 25, 2011

I have 3 movieClips call A,B and C, and added to stage one after another, in a nested manner. where a is parent of b and c, b is parent of c and child of a.However I get an error after trying to add child to movieclip c into b?[code]

View 3 Replies

ActionScript 3.0 :: OnReleaseOutside In Not Working In Child SWF?

Jul 21, 2010

I have "sq_mc" and "status_txt" on Stage.

I am using equivalent of onReleaseOutside which is: this.stage.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

It works fine. but when I open this SWF in another SWF it doesn't work.. !!

when I press mouse on sq_mc and release outside, counter stops.

but I want to stop the counter when I press mouse on sq_mc and release outside where my SWF which contains sq_mc is in another SWF in browser.

in simple ways... if path of SWF is "browser >> SWF" it works.

but if path is "browser >> SWF1 >> SWF2 >> SWF3" it wont works. in this SWF1 is preloader, SWF2 is SWF loaded in preloader, SWF3 is SWF which contains sq_mc)

Code below:

Code:
var excelClickTimer:Timer;
var i:int;
this.stage.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler); //counter

[Code]....

View 4 Replies

ActionScript 3.0 :: Remove Child Of A MovieClip But Still Working?

Feb 26, 2011

have made interactive quiz which have 12 movieclips each movieclip contains loop animation and sound in it(on Timeline), i export them as classes, clip1, clip2, clip3....etc, now i m doing when user reach on question 1, then clip1. comes on screen and playes that movieclip and after clickicking on right answer clip needs to remove from stage, but it is happening that clip is gone unvisible but is sound is till working

var hint:clip1=new clip1()
addChild(hint)
when user choose right answer

[code]....

View 3 Replies

ActionScript 3.0 :: Hittest Only Working With 1 Added Child

Mar 29, 2011

Ive got this piece of script where i place objects on the stage, to hittest eachother.Ive got two seperate addchilds: one child must hittest another child.[code]only one instance of the hitte_mc will hittest with the instances of Ring.

View 5 Replies

Actionscript 3 :: Dispatch Event On A Child Isn't Working?

Apr 10, 2012

I'm trying to do now is to make the application auto click on the first thumbnail,[code]I've been trying to google it and found that maybe I'll have to add an event listener to know when the thumbnail is actually being added to the stage, and just then click on it.I just found out that the code that Ascension Systems provided worked, but it didn't work at first because of a different error I had,the thing is, I'm working with the youtube API, FLVPlayback and such,And Each one of them is in a different movieclip,In the youtube movieclip I added this function:[code]I am setting the player as an object in the beginning of the script like so:var player:Object;

View 1 Replies

ActionScript 3.0 :: Child Call To Parent Function Not Working

Jan 12, 2010

I have a main MovieClip that creates a new instance of an imported class which is a page in the application. This class tries to call a function on the main MovieClip and it's not finding it. I've done this in the past without any problems with separate swf files and loaders, and with movieclips in a library. I'm at a loss on how to resolve this. Here's what I'm doing (simplified for posting):

[Code]....

View 5 Replies

ActionScript 3.0 :: Frame Actions Not Working On Child Movieclips

Mar 13, 2009

I've found the solutions for most of my many problems with as 3 but this one is really baffling The frame actions of child-movieclips of dynamically added movieclips are not firing! If I have movieclip, say "mc", which contains a child-movieclip "submc" which has a timeline animation in it with "stop();" on the last frame and I add "mc" on the stage via addChild() the stop action inside the sub movieclip will not work.

All the frame actions inside "mc" itself work. Everything works if I drag the movieclip onto the stage manually. Right now the only way I can see to stop a movieclip on its last frame is by using the ENTER_FRAME event, but that's awfully cumbersome.

View 9 Replies

ActionScript 3.0 :: Multiple Buttons To Open Child Swfs Then Be Able To Close The Child From Within The Child?

Mar 25, 2009

I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage

View 2 Replies

AS3 :: StartDrag X Y Coordinates?

Jan 11, 2008

not sure if this is possible but i'd like to get the X,Y coordinates of a button I drag. here's my problem:

PHP Code:
public function backbuttonDown(e:MouseEvent)
{

[code].....

View 10 Replies

F8 :: StartDrag() Multiple Mcs At The Same Time?

Nov 1, 2007

is there a way to drag multiple movieClips at the same time? Flash help explicitly says: Only one movie clip can be dragged at a time. After a startDrag() operation is executed, the movie clip remains draggable until it is explicitly stopped by stopDrag() or until a startDrag() action for another movie clip is called. anyone know of a way to do it anyway? maybe combining them in a dynamic mc or something?

View 3 Replies

ActionScript 3.0 :: Can't Disable StartDrag

Feb 21, 2009

I have a zoom in function and when I'm zoomed in I can drag the movie clip around with a drag function I have a zoom out function which restores the movie clip to its original size but I would like the drag function to be disabled while zoomed out.[code]...

View 4 Replies

ActionScript 3.0 :: StartDrag With MouseEvent?

Sep 24, 2009

I've created a function called dragItem() that I call with the MOUSE_DOWN event. I've got it working....kind of. I can access the function when the mouse is clicked and I can even get the name of the instance when the mouse is down. I'm trying to use the same logic to get the single object to allow a drag. see my code below...
 
function dragItem(event:MouseEvent):void {            var instName:String = event.target.name;            trace(instName);            trace(event.target.width);                        event.target.startDrag();                        event.target.removeEventListener(MouseEvent.MOUSE_DOWN,dropItem);            event.target.addEventListener(MouseEvent.MOUSE_UP,dropItem);                    }
 
I get this error when I try to drag the item...ReferenceError: Error #1069: Property startDrag not found on flash.display.Loader and there is no default value.    at Main/::dragItem()

View 8 Replies

ActionScript 3.0 :: StartDrag Within A Loaded SWF

Jun 16, 2011

I have an index file in which I load my external .swf. One of the external .swf has a drag and drop quiz. And as you can guess, the startDrag doesn't work! In fact, when I publish within Flash it works just fine, but when played within the index file, it stops working!

For your information : all my files are in AS3.
 
So here's a bit of my code.

var interbouton : Number = 10;
//I have 7 items that I can dragfor(var i:Number=0; i<7;i++){ var dragBtn :MovieClip = new Drag();

[Code]....

View 2 Replies

ActionScript 3.0 :: StartDrag And Bounding Box

May 5, 2008

I have noticed when setting a bounding box on a drag object, if you go outside the bounds of the box you have set, the mouse won't let go of the object unless you go back inside the bounds and click on it again. Is there any way to force the stopDrag if you go outside the bounds while dragging? I have tried this bit of code:

[Code]..

View 3 Replies

ActionScript 2.0 :: Tile Map Using StartDrag()?

Feb 5, 2009

I'm making a strategy game the uses a tile map to show information about the other players! Every tile is 50*50px and when you start the map it loads about 50 tiles and puts them together (all this from a Flash->ASP->MySQL which i managed to do on my own)

What i need to do is to make the map draggable (kinda like maps.google.com) and make every tile clickable! I can't manage to do both of these things at the same time All the tiles are in a movieclip called mapMc so by creating a big button above the visible map area and write:

ActionScript Code:
on (press) {
allSize = _global.fullMapSize/2; //This gets the size of the map after all tiles have loaded[code].....

And that kinda works (except for the boundaries)Second, when you press a tile, which i stupidly constructed as another button, so every tile is a button (loaded dynamically) with as that fetches the tile information (already fixed ) But how do I combine them?

View 0 Replies

ActionScript 3.0 :: Can't Disable .startDrag?

Feb 21, 2009

Ok it's 5am so I'm just not thinking clearly and am straining to read my code and I cannot get this to work.

I have a zoom in function and when I'm zoomed in I can drag the movie clip around with a drag function
I have a zoom out function which restores the movie clip to its original size but I would like the drag function to be disabled while zoomed out.

[Code]...

View 5 Replies

ActionScript 3.0 :: Run Only Once StartDrag And StopDrag?

Dec 31, 2011

i created quiz. Questions of quiz, two question are fill inthe blank and others are multiple questions. i want to add matches question using startdrag-stopDrag. it runs in seperated fla. But it doesnt runk when i add to quiz.fla, actually mybadscrore doesnt work. However , how i can do to run only once square1.mc?

Code:

square1_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(e:MouseEvent):void

[Code].....

View 3 Replies

How To Make A Infinit StartDrag

Mar 25, 2009

How to make a infinit startDrag So something like :Code: Select allstartDrag(this, false, 0, 0, infinit, infinit); Only this code acts like this:Code: Select allstartDrag(this, false, 0, 0, 0, 0); And also I'd like this startDrag to work with negativ cordinates.

View 2 Replies

ActionScript 2.0 :: StartDrag Outside Of Boundries?

Nov 22, 2006

trying to made a jigsaw puzzle, and using dynamic function to cut picture to pieces, but the pieces are not drag properly, except top-left coner one.how to make a good jigsaw, please share with me, it's my first game program in my life,

Code:
for(i=1; i<10; i++){
this.attachMovie("ad1", "pic"+i, 9+i, thumb);
_root['pic'+i]._x = 5;[code].....

View 3 Replies







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