ActionScript 3.0 :: Stop The Movement Of One Object When One Other Object Is Over One Third Object?
Jan 8, 2011how i can stop the movement of one object when one other object is over one third object
View 1 Replieshow i can stop the movement of one object when one other object is over one third object
View 1 Repliesi need a movement script that makes an object move to where i want it to then stop. i cant seem to find a script for this anywhere.
View 4 Replieshow do i stop the movement of an object moving from left to right. I want to be able to place it anywhere id like.
View 2 Replieshow 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].....
is there a way in action to group to object so when one object is drag across the screen the other object sticks with it, im using flash btw
View 6 RepliesSo I have this Photo class than handles loading a pic, and dispatches an event when the loading is done with:[code]which is simple and works, but now I'd like to make something more advanced. I'd like to dispatch the load ratio.So far I have extended the Event class, with my own EventRatio class, and I can put properties on that class. Which is cool, but I need something more dynamic than just sending a fixed value.So, what is the best way to connect the Loader object of the Photo object, with the EventRatio object?
View 5 RepliesI have this situation where i'm trying to save "chat logs" while people switch around views in my flex mobile application..so, my plan is i'm starting out with a main object that I plan to re-use as the main chat log object..I call it textObjso, when someone new wants to chat my plan is to make a new object with the persons username.so how if i were to get the username from something like data.username how could I translate that into the var name of the object I want to make? So in the end i end up with.[code]
View 2 Replieshow to do an object move towards the mouse when i move the mouse the towards the object and backwards when i move the move away, something liike the menu on [URL]
View 2 RepliesI made a code which is supposed to move an object (Character) to the location of a button (1). I tested it, and it won't work.[code]I've attached the code directly to the button, but I just can't figure out what is wrong. Does anyone know?
View 21 RepliesI have an object who's movement I want to limit to a small rectangle on the stage.
View 6 Replieswell I have this frame as a movieclip called field. And inside it, there's another mc that is moved by the cursor keys called box. Now I have created another movie clip called boxclone. I want boxclone to make the same movement as the box in the field. I know it has something to do with localToGlobal but I don't know how to setup the code correctly...
View 3 RepliesI've made a sort of sliding menu in Flash (CS4) which is basically a movie clip that has a function assigned to it that if the cursor goes over a button it starts moving in a direction.
Code:
_root.right.onRollOver = function() {
goRight = true;
};
[Code]....
Now, I don't want that "content" object to slide all the way out of the screen. How can I make it stop at certain position, say x=770? Or is there any better way?
So I have so parts of actionscript which I am figuring out on how to make them one. What I am wanting to do is move an object to the right and fadeout. Here is my code to animate right 10 pixels, this works perfectly.
[Code]....
Trying to use an enterFrame event in conjunction with two functions that combined I want to move my object (a square) from the right to the left side of the screen and rotate it AROUND THE CENTER.When I use the following functions individually, they both work fine:
Actionscript Code:
//Centering function function rotCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) { var m:Matrix=ob.transform.matrix; m.tx -=
[code].....
I am trying to get an object to track my mouse on press and i am using a tween. However, the nature of the tween is such that the time taken for the object would move would always be constant despite the distance.
I would like to make the object travel at a constant speed regardless of the distance. Is it correct for me to use a tween? If not what should I be using?The code for my tween is as follows.
map_mc.tracker_mc._x = map_mc._xmouse;map_mc.tracker_mc._y = map_mc._ymouse;startx = map_mc.crosshair_mc._x;endx = map_mc.tracker_mc._x;starty = map_mc.crosshair_mc._y;endy = map_mc.tracker_mc._y;
trackTweenx = new Tween(map_mc.crosshair_mc, "_x", Regular.easeIn, startx, endx, spd, true);trackTweeny = new Tween(map_mc.crosshair_mc, "_y", Regular.easeIn, starty, endy, spd, true);
map_mc.tracker_mc is the mouse cursor that would appear when onPress while the map_mc.crosshair_mc is the object that would track my cursor's movements.
I have an object that is being moved along it's x axis a certain amount each time an button is pressed. I want to be able to restrict the movement of that object along it's x axis so that it can not go past a certain point.
View 2 RepliesLet's say you have a room, and a little circle representing the player. Let's say also that you decide to draw a shape overlapping the room, set alpha to 0%, and use hitTestPoint() between this shape and the player to create the movement boundary. In short, as long as the player's centerpoint is overlapping the invisible shape, he/she is free to move around.Now, I decided to make things more complicated and add an obstacle to the room - a table in the center. One would think that cutting a rectangle out of the middle of the invisible shape would prevent the player from being able to move there. No dice, the player passes right through the hole in the middle of the invisible shape. The problem, as I see it, is that when the shape is converted to a symbol for use in actionscript, the entire volume of the movie clip is used for collision detection, not just the shape's volume. No matter what options and settings I play with, I can't get the hole in the shape to stay cut-out when I convert the whole thing to a symbol.
Now, I know I could probably add an extra shape to represent the obstacle, and add extra collision detection into my actionscript. However, given that there will be a large number of rooms in the game, and a variable number of obstacles in each room, this is not an elegant solution. The most elegant solution would be to figure out a way to map the playable area in a room with a single movie clip (/graphic).So, I turn to you fine folk. Can anyone tell me how to convert a shape to any kind of symbol, and preserve features like holes within the shape (as in, not have them glazed over as part of the symbol's body
I am looking for the AS for moving an abject with WASD. I had it working with Key.Left, Key.Right, Key.Up, and Key.Down but I want to change them to WASD.
Code:
if (Key.isDown(Key.LEFT)) {
this._x+=moveSpeed;
} else if (Key.isDown(Key.RIGHT)) {
this._x-=moveSpeed;
} if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
}}
I hope that this topic hasn't been discussed ad nauseum; I searched the forums for similar discussion threads to no avail. I completed the Flash MX object movement tutorial found at [URL].I then wanted to add a second instance of the beetle symbol to the stage and assign it both a new instance name and a different set of keyboard keys that would control its movement.
When I test the movie, I am able to control each symbol instance with its assigned keys. (The instances move and rotate as they should.) However, when the first instance rotates and moves to the right, the second instance "slides" with it. That is, the second instance's assigned keys have not been pressed and it doesn't rotate, but it moves right in unison with the other instance.
making a game, and in html, on press arrow key up or down, moves the object and the screen
View 2 Repliesmake snap object on the mouse movement. As, I have made the code but getting issue on removing from snapping. I have attached the file. you can look in the [URL]
View 1 RepliesI have made a class file player and another class file landscape. The player class file has methods that allow the player to move. Where would I put code to make the landscape move with the player? Would the code go into the player class file or the document class file? I don't know how I could link the landscape movement with the player movement
player.as class file
Code:
//the package
package actionscript{
import flash.display.*;
import flash.events.*;
import flash.media.*;
[Code] .....
I searched the forums for similar discussion threads to no avail.I completed the Flash MX object movement tutorial found atI then wanted to add a second instance of the beetle symbol to the stage and assign it both a new instance name and a different set of keyboard keys that would control its movement.When I test the movie, I am able to control each symbol instance with its assigned keys. (The instances move and rotate as they should.) However, when the first instance rotates and moves to the right, the second instance "slides" with it. That is, the second instance's assigned keys have not been pressed and it doesn't rotate, but it moves right in unison with the other instance.
View 6 RepliesI am currently creating a game similar to cafe world, farmville etc (social game). Would like to know how could I make an object move in an isometric direction when my mouse move. For example, when I want to build a house, I click on the house build button, and when my mouse move, I want my house object (stored in the library) to be move together with my mouse in an isometric direction. To give you all a better impression of the solution i am looking for, click on this link for a sketch: [URL]. So I want something like only when my mouse move 20 units more than the original mouse position, then my house item should move to the next grid.
View 1 RepliesI'm developing a flash application. I am looking for a simple way to animate my camera's movement. Is there any built in tweening library that supports the camera object? I've checked out greensock.com, but I couldn't figure out how to use their libraries for the camera object.
EDIT: by camera I mean the viewing perception. Not a real hard drive web camera.
Trying to create an object flying around using random movement. Instead of a straight line bounce-off-the-wall movement, I'm trying to get it to move in a curved path like a bee flying around.
View 1 RepliesI have a menu, that moves left and right using a move left and move right button that makes more of the menu come into view in the left and right direction.I want the object to stop moving when it's at the beginning and stop moving at the end.I thought I could set a 'max x coordinate' so that if previous was hit the object would not move anymore to the left but it still does.Here is the code I tried to use that doestn' work:
Code:
My Previous Button:
on(press) {
currentX = _root.years._x;
_root.years._x = currentX + 400;
[code]....
I use something like this code to detect the speed of the movement of a dragged object
PHP Code:
if (!go) {
this["position_"+i] = this._y;
i++;[code]....
This way I can find in what direction the mouse vertically has moved and at what speed. The problem is that every once in a while the speed will be in the opposite direction. What do people use to detect the direction of the movement of the mouse?
How can I make a circular movement of an object around a point ?
View 2 RepliesWhen I use MouseEvent.MOUSE_OUT the target is [object MovieClip], but when I use MouseEvent.ROLL_OUT I get [object Bildspel] - and Bildspel is my class. The thing is that when I use ROLL_OUT I'm not able to delete the targets ENTER_FRAME event.
[Code]...