ActionScript 3.0 :: Dragging Objects In One Direction?
Aug 13, 2011i want to drag objects using startDrag() method only one direction either X or Y .
View 1 Repliesi want to drag objects using startDrag() method only one direction either X or Y .
View 1 Repliesi am developing a flash game where i need to drag movie clips but i have to allow dragging only two direction x and y.
View 1 RepliesI want to create a flash movie which firstly loads a selection of images/objects into a portion of the frame. After this is complete, the user can then drag these objects onto another area and the object will be created where the user has chosen. The user can then drag another instance of the ojects onto the area.
For example, there is a background of a lake in one area. A selection of boat pngs are loaded in an area below the lake. The user can drag these boats and place them on the lake. They can drag a boat multiple times if they wish.
The code for dragging an object with the mouse is known:
mc.onPress=function(){this.startDrag(false);};
mc.onMouseUp=stopDrag;
I tried to drag two objects at a time using
mc.onPress=function(){this.startDrag(false);mc2.st artDrag(false);};
mc.onMouseUp=function(){this.stopDrag();mc2.stopDr ag();}
But this seems to drag only the object, corresponding to the last parameter in the function
How shall I drag more than one object at a time?
I have need to simultaneously move a slider (called "shadeGrabber") movie clip and a mask. I'd like to do this by dragging the slider and seeing the mask move with it.
The example movie clip on the left (called "PICTURE_WIPE") is what I'm going for, but interactive instead. I'm working in the movie clip on the right (called "PICTURE_WIPE copy 2")
Here's my code, for quick reference (found on the "AS" in the "PICTURE_WIPE copy 2" movie clip:
[Code]....
I've been searching various sites and forums for a solution to this, but have so far found none, so I was hoping to ask for some advice on the subject.Basically I have a movieclip of a photoframe, and I'd like it so when the user clicks the edge of the frame, they can drag it around, while clicking the photo inside the frame will open a new window and show the photo in full view.Originally I thought I could accomplish this simply by using:(Note: Framemc is the main movieclip, with another mc called "Photo" inside which is the picture)[code]But this leads to an odd problem: When dragging the frame it works fine, but the user can also drag the "photomc" around too (like, the frame stays in place and doesnt move with it), thus removing it from the frame.Is there a way to tell the code to move only certain parts of the mc and not others?
View 1 RepliesI just wanted to know if there is a way to startdrag() multiple objects at once. I don't want to use the mousemove/enterframe + x And y offset method of dragging, but just use the built-in startdrag method. Making startdrag function multiple times with different objects didn't work.
View 3 RepliesI have two drag-related questions. The first one is how to rotate an object by clicking and holding on it, then moving the mouse round in circles. Think of a clock face, and the user clicking and holding on one of the hands, then spinning it around. The centre point would be the part of the hand that's attached to the middle of the clock face, and the other end of the hand would be able to rotate 360 degrees around the face.
The second one (and not related to the first one, a separate query altogether) is how to drag something horizontally along the screen, but have it stuck at a certain speed. So if the user tries to quickly drag the clip from left to right, it will not reach the right instantly, but instead follow the cursor at a slow speed.
I have an extremely simple fla, that I wanted to add one thing to, but can't get it to work right. There are 5 layers, each one has 1 key frame and that's it.
1. "Actions" Layer
Code:
startDrag("mask", true);
[code].....
Basically after adding an object on stage (using actionscript), it will be situated at a random rotation angle using:
this._rotation = Math.random()* 360;
After that, I want my object to move in the direction that it is facing, (using onEnterFrame?). How do I do that?
I can't say that I have played with it much, but I was looking to use a gradiant fill in one of my Sprite objects I created in flash. Seems that the gradiant fill always goes left to right... how can I make it go up and down? I know I can rotate the object, but then I would mess with the x and y scales that would mess me up later down the road. is there a way to change it to vertical fill?
View 2 RepliesI have for a long time tried to get rods beeing placed side by side without overlapping after dragging. I don't succeed. This side shows that it can work: [URL]. I want my objects beeing placed side by side or over each other, not overlapping and no space between, just like in thos link.
Code:
var mcArray:Array = new Array();
var lastClicked:MovieClip;
function drag() {
this.startDrag();
lastClicked=this;
} function dragEnd() {
[Code] .....
I have several shapes on the screen implemented as movieclips.I need to allow the user to drug the objects with the mouse as well as to resize them (i.e. to change objects' _xscale and _yscale)To do every one of these tasks (drug, blow up and blow down) separately is a trivial task.
View 3 Replieshow can I drag a specific image without dragging all the other objects. The image to be dragged is exported dynamically from the library and activated on a mouse over. Here is the code:
function myImage(event:MouseEvent):void {
var img:BitmapData=new livery(0,0);
var MyImg:Bitmap=new Bitmap(img);
[Code]....
I have a bunch of draggable objects and I want to be able to rotate them. Is it best (possible?) to rotate them based on keypress or how might you go about this. Here is my keypress code so far ( draggin works - rotate doesn't )
[Code]...
I've made a working custom cursor, but a separate mc which was a draggable object with the default cursor now ignores the custom cursor.
my code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, newCursor);
Mouse.hide();
rectangle2_mc.addEventListener(MouseEvent.MOUSE_DO WN, dragger);
rectangle2_mc.addEventListener(MouseEvent.MOUSE_UP , dropper);
[code]....
is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage? for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates. currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.
View 2 Repliesi have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??
View 1 Replieshave a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..
ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
[Code]....
how to make that first ball did not change its direction and continued to fly in the direction of the shot?
I designed a horizontally oriented page that expands to the right. The problem is, the content goes off the screen.
I want to know how to make all of the content on the website scroll with the mouse direction like this webpage- sectionseven.com
Does anybody know how to do this or something similar?
I need a code in AS2 that launches a bullet ("bullet") from the character ("hero") towards wherever you clicked the mouse.For example, if I click somewhere, I want the bullet to launch straight towards where I clicked.
View 10 RepliesIt is really nice to see the new text direction for TLF but i have one problem with it.We are trying to localize our flash application using strings. so far we follow the traditional way of translating each string and assign it with ID. Our 2 main languages are English and Hebrew. The problem is that for english we need to use LTR direction while in hebrew it is RTL.in a big flash application were the number of tlftextfields are big it is impossible for us to change the direction for individual tlftextfieldsin .
View 5 RepliesI need a push in the right direction. I have been programming ActionScript 3 for about a year and am just starting to separate my code out of the Flash using classes and things like that.
Anyways here is the problem. [URL].. Go here and upload an image and notice how when you drag the image a black box still appears to visually show the image is under the Obama logo image. I am trying to figure out how this was accomplished.
First: Is a mask being used to only show the image in that particular area? Or is this an transparent gif above the uploaded image? If a mask is being used then how is the rectangle achieved and how is the drag and drop still working when the mask hides the image?
Second: How is this box effect being achieved? Those are the most important questions. I figured out how to make an image resize using a slider. However I am curious how this guy did the advanced image resizer.
If someone can point me in the right direction as to how this is accomplished that would be great. [URL]..
I have a AS3 script where I'm using a TextFiled Object. I retrieve the text from the database with the help of a PHP script. The problem is how can I use RTL direction in a TextField Obj?
View 1 RepliesI posted a thread last week and I get a code that give me possibility to move circle in the stage and when it got to the end of the stage it turn around and change it's way. but the code was only for X direction but I want to use it in Y direction too, to move the circle diagonal. I put the code down here. me to add Y position guide me how to add.
ActionScript Code:
var circles:Array = new Array();
var quantity:int = 2;
[code]....
I've been experimenting with path finding, in particular the A* algorithm. I've understand the basics for it and can currently get an object to move from point A to B avoiding walls. However I'm trying to create one way blocks, (then eventually add turn left and right only and T juncs etc) so I don't have to use thick walls to prevent the object from taking a certain route. The code I have so far is....
[Code]...
Press the picture to get it larger. That's what i really need for my project. I can't get it to work.please explain it for me to, im learning flash so I can need that to understand sometimes
View 1 RepliesI am having a problem with this actionscript, i post it on my mc but it doesnt work. (except for the turning it just wont go forward or back)
CODE:
onClipEvent (enterFrame) {
//This code will advance the car forward.
if (Key.isDown(Key.UP)) {
speed += 1;
[code]....
I have had the following problem for a while and i cant find any solution on google.I have the following and what i want to do is only allow the object current_switch_selector to be dragged in a horizontal direction but when i use the following for example it doesnt work
var bounds_rect:Rectangle = new Rectangle(0, 0, 17, 10);
trace(bounds_rect);
current_switch_selector.startDrag(bounds_rect);
[code]....
I'm making a game that is birds eye view like the old grand theft autos. anyway im currently stuck at this... I can have my character fire and have the bullet follow my mouse but I cant seem to figure out how to just make the bullet go straight off the screen in the direction my character is facing.
View 2 Replies