ActionScript 3.0 :: StartDrag Confined To Y Axis?
May 20, 2011
After adapting loads of code from load of different places, I've ending up with this code.
ActionScript Code:
import flash.events.MouseEvent;
var constraints:Rectangle = new Rectangle(text123.width/2, stage.stageHeight/2, 0 ,text123.width - text123.height);
[Code].....
I cannot get this movieclip to only drag vertically, and not be contained by the stage. I'm trying to create a masked, non-scrollbar, scrollable text.
View 9 Replies
Similar Posts:
Sep 19, 2005
How would I constrain it to the x axis?Also, how can I put a maximum and minimum _x value on it, that it wil always stay between?I'm sure I know this already, just can't remember.Edit: nevermind,and you just need a couple more parameters.Edit2: Ok, new question, I have this code, to make a little bar follow the mouse behind the menu, it works ok, but I can't click the buttons anymore, and the rollOut doesn't seem to work
Code:
leftConstraint = 60
topConstraint = 0
[code]....
View 2 Replies
Jun 1, 2004
I want to make a handle pull up and then down through an arc. Now using the startDrag on the Handle won't make the handle pivot around an axis. It needs to move a bit like a (one arm bandit) or (The old coin Poker Machines) I have attached a basic file to show the problem I have so far.
View 2 Replies
Jun 1, 2004
I want to make a handle pull up and then down through an arc. Now using the startDrag on the Handle won't make the handle pivot around an axis. It needs to move a bit like a (one arm bandit) or (The old coin Poker Machines) I have attached a basic file to show the problem I have so far.
View 2 Replies
Dec 1, 2007
So I have a Sprite and if using startDrag(), how do I constrain the movement to x-axis only? that is, move it horizontally? The free x,y movement code sample is here, directly from Adobe's livedocs: [URL]
View 14 Replies
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
Nov 27, 2011
I am trying to construct coordinates with distance in meters on the x-axis and time in seconds on the y-axis, without using the timeline. How can I draw the divisions on the x-axis and y-axis ? Or I better draw the whole thing.
var my_shape:Shape = new Shape();addChild(my_shape);
my_shape.graphics.lineStyle(3, 0xFF0000, 1);my_shape.graphics.moveTo(50,50);my_shape.graphics.lineTo(50, 300);my_shape.graphics.lineTo(500, 300);
View 9 Replies
Mar 2, 2005
I'm trying to grasp how functions and motion tweening works.
Heres my question. How do i make an object move along the y axis once it has reached its x axis target?
HEre is the code, that i got from here.
and what in this code is making the MC ease out?[code]...
View 14 Replies
Aug 7, 2009
I've put together this simple code for an SWF with three roll over images (called: Training, Resources and Contact).When I roll over Training I would like the symbol Training_txt to tween its alpha to 1 (from 0) and tween its y axis to 220 (from 83).When I roll out of Training I would like to run the two tweens in reverse.
This works fine for each of the three roll over images, so long as each tween is allowed to fully execute before a new tween is started. The problem arises if i quickly move the mouse curser between the three roll over images before the previous tweens have finished executing.In this instance, the tweened objects start to behave erratically. They usually return to their original position as per the roll_out tween but then start jumping between y axis 200 and y axis 83 (without tweening - they just appear).
Code below -
stop();
import fl.transitions.Tween;
import fl.transitions.easing.*;[code]..........
View 1 Replies
Jun 7, 2004
I've found a similar thread to this but my problem's a little different.I've never used the drawing function on Flash and I followed the fairly simple tute on it just recently.Is there any way to confine the drawing area to a specific shape. Mine's a rectangluar shape that's rotated. You can download my FLA with the background image here > url...I'd like to try and keep it confined to the notepad area.I think it might be a hitTest thing with if/else. My other thing would be to just rotate the notepad so that it's straight.Even still i'd like it confined to the area beginning with the corner of the notepad, not the corner of my movie.
View 2 Replies
Feb 23, 2004
I was wondering if there was a way to make movements confined to a certain order. I saw a DNA effect, and it was quite awesome.
View 5 Replies
Apr 13, 2012
I'm making a chart where the x-axis needs to have dates and y-axis names. The lenght of the bar is longer when the date is later. But I want to stack multiple bars on eachother. for example This is the code I have so far
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[code].....
View 1 Replies
Nov 6, 2007
I'm trying to modify a mouse trailer I've found somewhere else so that it only reacts within a specific area on the flash page - say an area 780x549 on a 1024x700 flash file.Here is the code I am starting with - The file is written in AS2 for Flash 8+
//mouseTrailer
i=0
onMouseMove = function () {
var cur_x = _xmouse;
[code]...
View 1 Replies
Feb 21, 2009
I'm making a pokemon clone, mostly for the learning / instructional value. I've had little trouble loading in my tilesheet for the maps, but recently I decided to use a different sheet. Lo an behold, the data loads, but an Event.COMPLETE never fires, and if I look into the contentLoaderInfo, I see the data is null. However, it's only with the one tilesheet I want to use! Other sheets load just fine. It turns out, the issue is that the tile sheet was originally 256 x 15008. With flash 10, we're supposed to be able to work with bitmapData of max 8000-something in one dimension.
So I redistributed the sheet to be within the 8-thousand limit. Again, it failed to load. It wasn't until I got both of the dimensions within 2880 that it actually loaded. Thus, while we're supposed to be able to edit huge bitmaps, apparently the Loader class still can't load an image with a dimension greater than 2880? 2880 is the previous (flash 9) limit on a bitmap data. My sprite sheet is a png 24. So there's a chance this is just a png thing, but I did try to save it as a gif and load that... it fired a complete but it was completely blank once it was loaded in.
View 4 Replies
Jun 7, 2004
I've never used the drawing function on Flash and I followed the fairly simple tute on it just recently. Is there any way to confine the drawing area to a specific shape. Mine's a rectangluar shape that's rotated. You can download my FLA with the background image here > [URL]. I'd like to try and keep it confined to the notepad area. I think it might be a hitTest thing with if/else. My other thing would be to just rotate the notepad so that it's straight. Even still I'd like it confined to the area beginning with the corner of the notepad, not the corner of my movie.
View 2 Replies
Jul 20, 2010
I am needing to create random movement of multiple movieclips in a confined space. I am creating a group of fireflies that disappear and reappear at random spots.
View 19 Replies
Mar 22, 2011
Based on this Adobe multiple axis chart example: [URL]
Then I changed some data values to negative and my axis became not aligned anymore.
how to align vertical axis? Is this another Adobe bug or there is some property that aligns axis?
<?xml version="1.0" encoding="utf-8"?>
<s:Application
minHeight="600"
[Code]...
View 1 Replies
Nov 14, 2008
I just made a scroll area with buttons and draggable items. All the code is written for vertical scrolling, the content I need to be scrolled is going to be horizontal. how can I rewrite this code to be horizontal scrolling? it seems like the scroll button (the one you drag along) doesn't stay confined to its scroll line either.
[Code]...
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