ActionScript 2.0 :: If Statement Stop An Object From Moving?
Feb 8, 2010
I am trying the get the center movie to stop remaining centered with the scaling movie when It gets less than 200 pixels of the left hand margin. x.200 and stop being centered on the y axis also at 100 pixels y.100 Here is the current code I was trying to write that is positioned on the object: Just avoid the comments, just left them there for reference to what's in my movie. Also need an if statement made for the y axis. (explained earlier)
onClipEvent(load){
this._x = Stage.width + 250;
this._y = Stage.height/2;
// This function will Position the object in Place
[code]....
View 1 Replies
Similar Posts:
May 11, 2010
I have this code where I want edge_btn to move to the left side of the stage, but I can't figure out how to get it to stop. It just keeps going. Also, I have edge_btn rotating the entire time in the beginning of the timeline.
[Code]...
View 0 Replies
Dec 13, 2006
I am making a new site, and was making buttons that looked a little similar like this buts on the left) and wanted that to do with Actionscript.I followed a tutorial on Kirupa on moving stuff with actionscript
Code:
onClipEvent(enterFrame) {
speed = 30;
[code].....
View 5 Replies
Apr 7, 2011
I have a ball moving around the screen, position updated on ENTER_FRAME. My problem is that there is a considerable amount of flicker going on. I have thought about using something like TweenLite to move the ball but as the position is being updated frame-to-frame I don't think that will work.[code]...
View 2 Replies
Jun 27, 2010
Currently I'm trying to make a basic game (using AS 2) but I'm having trouble getting the basic physics to behave. I have a ball which is supposed to fall until it touches the ground. It can also be dragged around the screen by the cursor.I want the ball to fall only if it isn't being held, but for some reason the condition isn't working properly. No matter how I structure the condition, the ball still falls even when it's being held (in fact I can move it from side to side, it is still being held even though it's falling downward).I've tried putting this on the ball to make it fall conditionally:
Code:
onClipEvent(enterFrame){
if(hitTest(_root.ground1) == false){
[code].......
View 2 Replies
Oct 11, 2004
i 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 Replies
Jun 8, 2005
how 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 Replies
Feb 22, 2010
As the title says: Stop object from moving further when collision occurs.
Right now I'm trying to make a sliding puzzle. So far I have a block which I can click and drag around, and a few walls which are the boundaries. What I'm trying to do is make an area where the block can slide within the boundaries. So when you try to drag the block into an direction it will stop, whether you got mouse_down or mouse_up. My script so far
Code:
stop();
//Sliding Blocks
MCBlock1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
[Code]....
Also I need to use a lot of boundaries, so if there's a way to apply this script easily to several objects
View 1 Replies
Nov 2, 2010
im currently making an "AS3 beat em up" ala streets of rage or double dragon.Currently i have my character moving and a few animations done and i am trying to figure out how to make attacks work.I have some "basic" animation for his attack, but im not sure how to get it to work correctley.What happens is, if you press control (the attack button) whilst the character is walking he just keeps moving and is stopped on the attack frame.I want the character to stop moving if the attack is pressed and once it is released start moving again.
hero.gotoAndStop('still');
var left:Boolean = false;
var right:Boolean = false;[code].......
View 2 Replies
Aug 1, 2004
I have a MC that follows the mouse. I want to do so the MC will smoothly/softly stop when i stop moving the mouse. Is it hard to code, And it would be very nice if someone could do some code for it
View 2 Replies
Jun 16, 2011
The gotoAndPlay option isn't kicking in here. The object "sam_MC" proceeds along the specified root. But when the if statement containing gotoAndPlay becomes true, sam_MC simply stops moving and no other action is taken. When sam_MC's x coordinate becomes less or greater than a specified amount, I want the flash movie to restart. My code is located on the first frame of a layer I have named "actions." Here it is.
[CODE]....
View 0 Replies
Apr 25, 2011
So basically, I have an if statement, and if the condition is true, then stop checking the condition.
View 3 Replies
Jun 4, 2004
On a movie clip I have the following:
Code:
onClipEvent(load){
this._alpha = 0;[code]....
This only increases the alpha one step. Seems like the (enterframe) isn't repeating. Should I add an else statement to tell it when to stop?
View 2 Replies
Jan 1, 2012
what wrong with the functin 'stopFish' Without this function the fish in the tank swims but when I add it, it doesnt anymore. I just want the fish to stop swimming after I clicked it and start swimming after another click.
View 1 Replies
Aug 3, 2011
I have an animation that plays from the beguining to the end. I would like to add a conditional statement that IF the animation is Playing and the ANIMATION BUTTON is clicked, it stops and goes back to frame one. ELSE (if the animation is on frame one (not playing) it starts playing to the end.
My script goes like this -
animation_btn.addEventListener(MouseEvent.CLICK, startplaying);
function startplaying (event:MouseEvent);void{
play();
animation.play();
}
animation is the name of the animation time line.
View 5 Replies
Sep 11, 2010
I made a multibutton menu and I have a sound set to play when you click each of the buttons but the sounds play over one another if buttons are pressed one right after the other. I know theres a way to make each sound stop using an if statement just cant figure it out.
View 0 Replies
Jan 17, 2012
How can I stop the event listener and move into my second if statement I just can't get it to work
Code:
var step:int = 1;
if (step == 1)
{
[Code]....
View 7 Replies
Sep 20, 2008
I hope the following is pretty self explanatory. There is a ball movie clip "mc1" on stage. The addEventHandler simply starts a tween and the ball rolls from left to right until it's off the stage. I'm simply trying to make the clip stop when it reaches a certain x value on stage. I'm trying to teach myself simple techniques for the if statement and loops.
[Code]...
View 13 Replies
Jul 3, 2006
I have a animation in my loader_mc that I want to start at one frame and play to it then stop then when you click on it again I want it to play from a certain point. But what is happening is that it will initially do everything it is supposed to but than mess up after the initial 2 clicks. Check out the onRelease event and you will see what I am currently trying to do. [URL]
View 2 Replies
Feb 23, 2012
I am trying to do a apply a tween for the width property on a MovieClip Object but every time it changes the width and the position too, and I don't want that. I want to change the width going to one side without changing the x and y of the object.
I tried both of thes and they gave the same result.
var c:Tween = new Tween(left, "scaleX", Strong.easeOut, 1, 1.5,20,true);
var c:Tween = new Tween(left, "width", Strong.easeOut, 20, 200,20,true);
I think it is applying the transformation according to a center of the movie clip. but I don't know how it can be changed.
View 2 Replies
Apr 13, 2011
Im working on a small project and it involves a guy which you move with the arrow keys. The arrow keys add to his x, y velocities and his position is updated accordingly. How can i get this man to grab onto an object and spin around it (like when you grab pole and letting your momentum swing you around) . I can make him grab the object but I dont know how to modify his x,y speeds to simulate the arc.
View 4 Replies
Oct 13, 2010
my title explains what im need but im using flash cs4 and heres what i have so far:
var centerX:Number;
var centerY:Number;
var centerZ:Number;
[Code].....
ok so RBall is my first moving object and my orbiting object will be called orbit
View 9 Replies
Nov 19, 2009
Im going to attatch the fla on here...I am also going to give you the script viewable here...im completely a beginner so i made my self notes
also this is not all my coding im just learning off of it to create my own project... What coding would i use to tell the mc to stop scrolling once it reaches a certain x coordinate? for example x=0 (left side of stage) or x= -484 which is when right side of picture is at right side of stage... and can i setup math for it to automatically determine the correct x coordinate (based off mc width) to stop at?? if there is easier scripting to do the same....fill me in
oh and x is off of the stage typically...this is panoramic pics im scrolling
[Code].....
View 2 Replies
Jun 13, 2010
ok here is the scene
_root.playa
_root.playa.feetMC
_root.corneria
_root.corneria.limitsMC
[Code]...
View 3 Replies
Nov 11, 2010
I am making something like a slot machine and the main number (a movieclip placed in separate layer) moves vertically continuously.I made a button and how do I make the main number movie clip stop moving after pressing the button?Our office has Flash CS3 and all the actionscripts are manually written.
View 1 Replies
May 22, 2009
I am using a magnifying glass as part of my portfolio but when I click on another section and this loads an external swf above the main movie, because you can still see the main movie below, you can see the magify glass still moving as you move the cursor above?any ideas how I can stop the magnify glass moving while i am on the external swf above?
View 29 Replies
Apr 8, 2011
how to get the textbox to stop moving after i set the textbox location with the first click.
[Code]......
View 1 Replies
Oct 9, 2011
I want to stop the movieclips movement when it hits a wall (another movieclip). The example below works, but after the collision the movieclip 'blocks' all movement to the left...
For now the example with the leftArrow key;
variables to check the key, if it's hitting the walls and if it's moving or not:
var leftArrow:Boolean;
var speed:int = 10;
var hitting:Boolean;
[Code]....
View 2 Replies
Feb 21, 2009
I am a beginner to AS and I am having trouble here: I want to move a dog across the stage. I have two frames one with a movie clip with a dog animated like it is walking and the second frame he is standing still. I want to take him to the end of the stage and stop him when he gets to frame 2.[code]...
View 1 Replies
Jun 6, 2011
I am trying to limit the area in which the character (mcMain) can move I want to be able to keep it in an area (mcBuilding) I also have another area (inwhich the character is not supposed to get to) (mcBackground). (Also I want to be able to to make a dynamic text box that starts at 100 then decreases by 5 when the enemy (mcEnemy) hits mcBuilding and also that it gets removed)
View 1 Replies