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
Similar Posts:
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
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
Jun 27, 2011
I'm new to AS3 and I have a square(1200w) that's bigger than the stage(200w). Right now you can keep dragging it left and right as far as you possibly can. How can I set a imit/boundry to how much of the square you can drag? So that it can't be dragged beyond it's maximum width?Here's an image
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
this.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
function mouseDownHandler(e:MouseEvent) {
[code].....
View 1 Replies
Jun 7, 2004
I'm moving this little red box along the x axis. It just moves w/ the mouse but it moves off the movie clip area, i want to be able to set the left and right boundries. Heres my code.
mc_movingBox.onEnterFrame = function() {
var xMouse = _root._xmouse;
f(Math.abs(xMouse - this._x) < 1) {
[code].....
View 1 Replies
Jul 27, 2004
I want to code a button to duplicate a movieclip instance and I want it to move to a random location within certain boundries. I can duplicate it okay but i can't figure out how to move it.
View 1 Replies
Jan 24, 2012
I have few flash animations that I bought, I got their fla files as well.I modified the animations simply by adding a static text line. I publish the animation and load the swf file to another fla file (main project, which is bigger).The problem is that the loaded animation has a 1 fixel black frame (witch is not in the design itself) and I can't remove it or even mask it through the animation file. I need a clean animation with no background or frame,Other problem is that the loaded animation is getting out of the original file frame boundries, revealing parts that suppose to be out of the stage.How can I publish thouse animations without the frame and the out of boundries area?
View 2 Replies
Jun 5, 2006
URL...The game has a helicopter centered on the screen (the heli movieclip is in Scene 1, frame 1, Layer 2). Then I have a "World" movie clip on Layer 1. Inside the world movie clip are the enemies, weapons, and boundries of the map.The world movie clip is moved when the controls are used to make it look like the helicopter is moving (although it is actually stationary). When the space bar is pressed, the "bomb" movieclip inside of the "world" movie clip is duplicated, and the duplicate is placed at the correct coordinates in the "world" movieclip so that it seems like it is coming out of the helicopter. This is all working as intended.The problem comes when trying to hitTest the bombs with the boundries/enemies inside of the "world" movieclip. The "boundry" movieclip is also inside the "world" movieclip, and is part of the Boundry class. The hitTest is inside my "bomb" class. Heres the code:[code]But the hitTest just doens't work. I've tried every combination of legal hitTest statements between the two movieclips, and it wont work. As you can tell from the SWF...the bombs explode seemingly randomly. SO somewhere...somehow...the bomb is colliding with the boundry.
View 1 Replies
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
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
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
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
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
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
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
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
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
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
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
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
Jul 13, 2004
I've got a zoomable map within a frame, and of course I don't want it to be dragged out of view, right?
So, how do I set the startDrag (L,T,R,B) parameters when it's a different size when it's enlarged (zoomed)?
Would it be advisable to somehow set multiple conditions to do something like this? (if so, how would I do it?)
if ( between Size>100 AND Size<200) {
startDrag(this, false,400,150,600,250);
}
if ( between Size>200 AND Size<400) {
startDrag(this, false,500,250,500,150);
}
Would it be advisable to do something like that? If so, how would I code it?
If not, what would be a better idea?
...I swear, adding this zoom feature added a whole level of complexity to this map that I've never imagined.
View 4 Replies
Jul 28, 2009
[URL]
If you drag the map, it moves even beyond the edge of the map so the map eventually gets dragged off the screen. Is there any possible way to stop the map moving any furthur than its boundry?
The source is here - [URL]
View 3 Replies
Oct 17, 2009
I've on box named=box1, and added action script.[code]I want to make duplicates of box1 and script should be the same as above.[code]But when i click on button again, box1 duplicate is disappearing. I do not want that.
View 5 Replies
Oct 19, 2009
I am trying to created a constraint to a rectangle. I have the startDrag working and I am trying to constrain a square to the movie size of 600x400.I have been searching online help files but I can not for the life of me get it to work, would someone beable to put me out of my misery. I have attached the demo file I am working with but I will also post my script here for thoughs who prefer that...
Code:
("animation", false, 0, 0, 300, 300);
but know joy...
my code:
////Button Listeners/////////////
Code:
// BtnNav listeners
btnNav.addEventListener(MouseEvent.ROLL_OVER, btnNavOver);
btnNav.addEventListener(MouseEvent.ROLL_OUT, btnNavOut);
btnNav.addEventListener(MouseEvent.CLICK, btnNavDown);
[code]....
View 2 Replies
Jan 13, 2012
have a thing where i have a million drageable objects and to make it easy i made each one of them a movieclip with this on
on (press) {
startDrag ("");
}
[code].....
View 1 Replies
Jun 2, 2009
How can I drag a duplicated Movie Clip from DuplicateMovieClip Function? ( use one movie clip)Example below:
on(press) { duplicateMovieClip("_root.a1","a2", 2); setProperty("a2", _xscale,100); setProperty("a2", _yscale,100); } on (release) { startDrag("a2",true);}
It does dupllicat the Movie Clip but I can't drag the duplicate.I learned this from a very old Flash lesson. I wonder there is a new way to write it now.
View 3 Replies
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
Dec 14, 2009
Is there a way how the startDrag function can be used on 2 different movie clips on one stage?
I have my own photo slideshow player (photos + music) and I need 2 dragable movieclips (buttons). First one is on the timeline and second one on the volume slider. How to achieve that I could use the startDrag function on both of them in the same time?
Or is there any trick how to do it? A regular youtube player has 2 dragable buttons (volume, timeline) also...
View 3 Replies
Dec 20, 2009
I'm trying to use startDrag with a movie clip that contains a 3D cube (comprised of 3D planes). It only moves the face of the cube, but not the other sides. Can one use startDrag in 3D space, or is there another method?
View 2 Replies
Feb 26, 2010
I'd like to figure out how to get these four skulls to move on a constrained X axis on enter frame, and on CLICK, I'd like them to reset to their original positions.Example:On frame 1 is an mc I created named holder. Inside there's an mc named box. Inside box are four mcs, circles1-4, inside the circles I have four skulls.I've also created an mc called rectangle and dragged it over the first skull to get the coordinates I want using the following trace:
trace(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
Resulting in these coordinates: 143.95,119.05,131.15,61
So, this works MOUSE_OVER the circles
[code].....
View 19 Replies