ActionScript 2.0 :: How To Add Boundary For The Moving Movieclip
Oct 21, 2003
I have function for moving the movieclip but I would like to add boundary for it. And another thing is that the movieclip contains a textfield for receiving the text input from the user so I have the autoSize=true for the textfield. Then I wonder how to modify the code so that when the movieclip exist the boundary
View 1 Replies
Similar Posts:
Oct 21, 2003
I have function for moving the movieclip but I would like to add boundary for it. And another thing is that the movieclip contains a textfield for receiving the text input from the user so I have the autoSize=true for the textfield. Then I wonder how to modify the code so that when the movieclip exist the boundary, it couldn't move any more?
View 1 Replies
Sep 22, 2010
I have a MovieClip that can move up, down, left and right. If the MovieClip hits a wall, the MC bounces, and should not move past the wall--but if you continue to press either your up, down, left or right key, and don't let go--the MovieClip will go past the wall. I'm trying to figure out a way, to stop that from happening.link of movement
// function hitWall --------------------------------------------------------------
function hitWall(event:Event):void {
if (box.hitTestObject(wall)) {
[code].....
View 2 Replies
Dec 17, 2005
how do I stop one movieclip from going outside the boundary of another?
I'm guessing i need to assign maxHeight and minHeight according to the other movieclips dimensions.
What i have is on the main time line a movieclip load which i'm using as a spaceship in my game. But i dont want it to be able to go "off"" the screen so need to set a boundry.
I think i need to set a onClipEvent on the spacesip movie clip to assignthe max/min height.
View 4 Replies
Mar 24, 2006
I want to restrict the movement of my movieclip. For example, I only want it to move 100 pixels to the right and left.
Code:
class Drag extends MovieClip {
var ease;
var dx:Number;
[code].....
View 3 Replies
Nov 23, 2010
I have a map of isometric buildings that the player walks around. in the image I have 1 and 3 working fine. I find the corner points of the building and test it against the players location and sort out their depths. easy.but 2 and 4 are the trouble makers. the left and right side of the building.because its isometric there is that diagonal line making up the sides.my only idea so far is to draw a line box around the building at test collisions against the "feet" of the player. but to do that I must draw a box and make it invisible but still be testable against only the bottom portion of the player, the players feet.
View 5 Replies
Mar 7, 2009
I have a main MovieClip in which I have several frame labels, each will eventually have different MovieClips associated with them. First time through I want to play an "intro" MovieClip, which I have placed on the stage at the begining of the main timeline, then at the end of the "intro" Clip, go to the first frame label and play that MovieClip.
The way I was going about it was placing this code in the last frame of the "intro" MovieClip:
Code:
MovieClip(parent).screen_mc.gotoAndPlay("home");
'screen_mc' is the instance name of the Main MovieClip.
[URL]
View 3 Replies
Aug 19, 2010
I have a map which I am scrolling up down left and right. Currently the map can be scrolled infinitely. Can somebody share a line of code that sets the x and y limits on the scroll. I need the scroll to stop when it gets to edge of map graphic. I have seen it, just can't find it. Here is the code for the up scroll.
[Code]...
View 3 Replies
Nov 26, 2008
Im currently making a game that has one of those old-skool Fallout maps (a world map where you click somewhere and the "you" marker moves there) that im trying to replicate.I already have the scripts ready for map interaction (using onhit here). But i was wondering if someone could help me with a script that works this way:
1. I have a movieclip (the character)
2. When i click somewhere on the map i want this movieclip to move there. Not instantly but moving over the screen to that point where you clicked.
3. I also want there to be passages that when the movieclip hit that movieclip (named hit for example) it stops dead and doesn't move (will be used on the map for mountains and such) and the player has to click somewhere else to move it that path (im assuming this will be something like onhit: hit - speed=0 something but im not a good scripter and it would had to be worked into the script.
4. ok this one is kinda optional but would be great! If it's possible to have it worked in the script that when the clip doesn't move (and is stationary on the map) the movieclip stays on frame 1 but when the movieclip is in motion (and moving across the screen) the movieclip is on frame 2 (and reverts to frame 1 when it's not moving anymore and so no)
View 15 Replies
Aug 9, 2010
I have a movieclip that I want to move down and up.I use a new tween using the Elastic. easeOut property to move the movieclip down over a duration of 2 seconds.But right after it moves down I need to move it right back up so it looks like a uniform animation.I used setInterval(reverse,2000) and reverse contains yoyo();This almost works.Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up.It does not give the impression that it is 1 tween, which is what I was going for.I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'.It is too fast and comes to a halt, not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down.Is it possible to move the movieclip down AND up by using just 1 "new tween" function?
View 2 Replies
Oct 25, 2006
I have a movieclip that I want to move down and up. I use a new tween using the lastic.easeOut property to move the movieclip down over a duration of 2 seconds. But right after it moves down I need to move it right back up so it looks like a uniform animation. I used setInterval(reverse,2000) and reverse contains yoyo();This almost works. Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up. It does not give the impression that it is 1 tween, which is what I was going for. I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'. It is too fast and comes to a halt,not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down. Is it possible to move the movieclip down AND up by using just 1 "new tween" function? I am out of ideas.
View 2 Replies
Jun 4, 2004
I want to rotate an object in AS because i think moving it manually is a waste of time
View 1 Replies
Nov 17, 2002
how to make the scroll/list menu in 2advanced's portfolio section, it can be found here [URL]
I kinda had a idea on how to make it , by using a mask and movie clip which holds the buttons, and then just use the up and down buttons to move the movie clip up and down, but dnt really know how to really do this.
basically want to know how to move a Movie clip up and down when a up or down button is pressed with restriction to how much i can move it up and down,
View 12 Replies
Mar 7, 2010
I am using PopupManager in FB4 to display a custom dialog.
popwin = new TitleWindow();
popwin.addElement(myCustomDialog);
PopUpManager.addPopUp(popwin,this,false);
PopUpManager.centerPopUp(popwin);
It's possible to drag the popped up TitleWindow and let go of it when its gray title bar lies outside the bounds of the Flex app rectangle,and then the popup cannot be grabbed again.It's also possible to drag the TitleWindow downwards so it becomes completely invisible below the bottom edge of the Flex app rectangle.When the Flex app bounds are less than the full browser window,and the user is working quickly, this chances of this happening increase.Is there a simple setting that will keep this from happening, or must the programmer intercept the behavior during the drag operation?
View 2 Replies
Apr 26, 2010
Basically, the problem I have is that I'd like to limit the predators to their own hunting environment, ie. Polar bear to ice, killer whale to sea so that the penguin has at least some chance of avoiding either predator. My initial idea was to define a boundary (apologies if this isn't the correct terminology) around the ice, thereby achieving what I'd like but I have no idea how to do this. Am I thinking about this too simplistically? Also, I would like the killer whale to retain its ability to swim under the icebergs. Note: As you can probably tell, the killer whale is on the lowest layer below the sea and then the ice is on a layer above the sea.
View 0 Replies
Mar 17, 2004
I have a menu that i need to be able to drag, but the menu is only allowed to be dragged to a certain constraint. (i.e. before the menu can no longer be visible within the .swf) I have the basic drag ac:
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
}
How would i go about adding constraints to this mc?
View 6 Replies
Jan 17, 2007
When you call startDrag on a Sprite/MovieClip/whatever, you can specify a rectangle which the object in question will stay within.
Eg... startDrag(false, rect1); where rect1 is of type :Rectangle
how you would go about constraining the dragging to an arbitrary shape, say a triangle or a circle rather than a rectangle?
I figure I could just have a Timer calling a function to check the whole time but that doesn't seem particularly nice.
View 1 Replies
Jul 1, 2003
I have drawn a rectangle area in which I want to drag a copy of a MC instance from outside the rectangle.
1. I want to be able to define the rectangle as a boundary so that I can drag and drop a copy of the instance from outside the rectangle to inside the rectangle. If the MC instance is dropped outside the rectangle then the MC instance snaps back to it's original position.
2. Once the MC instance has been dragged and dropped inside the rectangle it can be dragged and moved around BUT only inside the rectangle and not outside it.
View 5 Replies
Sep 6, 2010
User is required to move the mouse within the movie clip, if the cursor is inside the movie clip, something will happen else if the cursor is outside the movie clip another thing happeno fill in the blank.yclip.onPress =function () {if (the mouse cursor is within the boundary of movie clip){flower._visible=true;}else{table._visible=fa lse;}
View 5 Replies
Mar 22, 2011
I'm running some AS3-based animation, a simple bounce effect. A ball lies above a line, gravity as acceleration increases it's negative velocity by 1 each frame. When it penetrates an arbitrary line it is move up accordingly and velocity is set to a high positive number (24).
At 40FPS, and with a high positive velocity set to the ball, the critical frame where it hits the "ground" doesn't always render (maybe four out of five times fails), yet tracing outputs that it did indeed go across the bounce areas. Here are the 4 critical positions where 456 would be where it was wrapped to the ground:
[Code]...
View 6 Replies
Mar 17, 2004
I have a menu that i need to be able to drag, but the menu is only allowed to be dragged to a certain constraint. (i.e. before the menu can no longer be visible within the .swf) I have the basic drag ac:
[Code]....
View 6 Replies
Aug 15, 2004
i made sum coordinates that my MC (supposedly) cannot pass. But he keeps going past them. i was wondering if sumone can take alook for me.
Code:
if (this._y<=175 && this._y>=400) {
moveYSpeed = 0;
moveXSpeed = 4;
[Code]....
ovcourse this is only a portion of my code but, can sumone check if its right? the variables speek for themselves.
View 1 Replies
Sep 14, 2004
All i need to do is put a boundry for the infinite menu to stop at for the left and rightThis is my code from the tut:
[AS]
onClipEvent (load)
{
[code]....
View 5 Replies
Jan 12, 2009
I have a movieclip that I am moving behind a mask to achieve a panning effect. I am able to move my movie clip onRollOver and stop onRollOut. So far so good, except that I have no boundaries or margins on my movie clip so when I keep my mouse on my button, my movieclip continues to move indefinitely forever. Can someone please tell me how to set boundaries on the left and right or how to limit the scrolling to an X -1000 and X +1000?
[Code]...
View 1 Replies
Mar 11, 2009
Basically I need to have a cartoon character walking to the right hand side of the screen and then turning around and moving back to the left hand side and so on.
I have some code done but it could be all wrong as I am not the best coder at all, just starting out.
Code:
package classes{
import flash.display.MovieClip;
import classes.RollableChar;
public class MainApp2 extends MovieClip{
//public var theCharacter:MovieClip;
//public var myCarrot:RollableChar;
[Code] .....
View 1 Replies
Sep 29, 2010
I'm exploring menu's in flash and I'm currently trying to put together a thumbnail menu where thumbnails are contained in a Parent MovieClip.I want to then be able to move that movieclip along the stage (to the left or right, depending on the keyboard key pressed)..I know I can do this using this code, when the Parent MovieClip
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);function myKeyDown (e:KeyboardEvent):void{
if (e.keyCode == Keyboard.RIGHT){my_mc.x -=125; }
[code].....
View 5 Replies
Jan 30, 2012
In my attempt to create a simple Pong-like game, I've encountered a very strange and at times severe visual bug.When I set the ball (A Flash CS 5.5 library MovieClip) in motion moving around the screen at a rather fast speed, I've noticed that sometimes the edges of the ball would be cut-off for a short moment in the direction it is moving.
When it happens, it almost seems like the position of the ball MovieClip is slightly ahead of its own border and thus the part that is outside the border fails to get drawn.
Here's a picture that illustrates how this looks - at least for me:
You can also view the .swf file online here: [URL]
Some technical data:
I've been unsuccessful in capturing the with a screenshot no matter how much I tried. Sometimes I would open the .swf and the bug would be almost non-existent while at other times it was very blatant. I'm using an EnterFrame event function to increment / decrement the x and y position of the MovieClip. I have never encountered any such problem in any Flash app, in this machine or others. Truncating / rounding the x and y values of the MovieClip didn't help. Neither did setting cacheAsBitmap to true.
View 1 Replies
Aug 10, 2009
On the main timeline I've got solar_mc also On the main timeline I've got planet_mc and inside planet_mc I've got pluto_mc.. In pluto_mc. the actionscripts are writen to display text info, change colors, mouseovers, etc... My problem is the actionscript written in pluto_mc makes moon_mc, crib_mc and hale_mc on the main timeline function (changing it's colours, information, etc...). But I need to move moon_mc, crib_mc and hale_mc to solar_mc. When I do so the pluto_mc action script does not work! How can I put moon_mc, crib_mc and hale_mc in to one mc (solar_mc) and still make the actionscript in pluto_mc work? I've used the _root. command in the script pluto_mc..
View 2 Replies
Jan 26, 2010
I've boiled this down as simple as I can make it. When I click on the down movie clip (which is inside the MC movieclip) it does indeed move the MC movieclip down 20. However, I need it to also move the "enemy" movieclip down. When I try running this I don't get any compile errors but when I click on the "down" and the MC moves down I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
[Code]...
View 3 Replies
Oct 6, 2010
If I have a movieclip moving random around the stage, and I have another movieclip I one corner. is it possible to add an event listener to listen after if the random moving movieclip comes over the other movieclip?
View 1 Replies