ActionScript 2.0 :: (flash) Draggable Mc With Boundary?
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
Similar Posts:
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
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
Oct 29, 2009
How to make boundary fill in flash, like paint brush. If I click on any position bounded area will be filled with particular color. I have tried to make it
import flash.display.Bitmap;import flash.display.BitmapData;
var bmd1:BitmapData = new BitmapData(20, 20, false, 0x00000000);
var bm1:Bitmap = new Bitmap(bmd1);this.addChild(bm1);
function boundary_fill(x:Number, y:Number, fcolor, bcolor){
[Code] .....
I have rectangle now I want to fill it with red color but it show attach overflow error .
View 5 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
Jul 17, 2009
first of all my requirement is to implement set home page functionality in flash for firefox (for ie its ok) in html it is possible to drag a link to the home button on the browser tool bar to set the home page. so i want to make such a draggable link in my flash movie.. i don't know whether it is possible or not.. or else i welcome any other methods to set home page from flash in all browsers..
View 1 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
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
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
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
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
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, 2010
i am trying to create a line that can be draggable and extedable from start and end points of line
View 1 Replies
Dec 24, 2009
Could you tell how the actionscript code would look like for such a job?
View 4 Replies
Mar 19, 2010
I have a MovieClip that I want the user to be able to drag inside the stage, but I don't want it to be able to move outside the stage. Currently I'm using this._parent.startDrag(); to allow the MC to be dragged, but I don't know how to stop it from being dragged outside the frame.
View 1 Replies
Mar 6, 2012
I'm new to programming AS 3 and Im trying to create just a simple puzzle game for learningI am trying to make it so when someone selects a puzzle piece, it becomes selected with a box around it that is dynamically created depending on clip size. I tried adding the clip that was created to be a child of the movie clip that is selected, when I went to drag it though it selected the shadow box instead.
View 3 Replies
Mar 31, 2009
I have a simple yet mind boggling problem on my hands,simply put I have a large MC (with its registration point in the center, i need it there), and it sits in a smaller stage (think of it like as if you were panning a map thru a viewer, like google maps) but i need a set of boundaries to prevent it from going haywire. Now i have tried a couple of methods ie [code]The above just manages to stop it but once it reaches that point the drag stops totally.
View 2 Replies
Aug 22, 2009
I am currently working on an AS3 where I need to fit many differently sized display objects within a rectangular boundary without them overlapping. If you take a look at this link, [URL]and take note of how the speech bubbles are able to align themselves in the swf without overlapping, this is pretty much exactly what I hope to achieve.
View 2 Replies
Jul 25, 2011
I am facing one problem that i want to restrict my boundary while my object is moving around a area.So i want to move my black color ball only one position left/right/bottom or topEventhoung if my ball presents in the left side edgeit should move left side. same thing for upper side, bottom side and right side.right nowi m using Mouse Down for DragMouseUP for DropInbetween MouseMove for finding its co-ordinates
View 1 Replies
Feb 1, 2012
How can i fit text inside Circular or Oval boundaries (not rectangular boundary)?
View 1 Replies
May 7, 2010
how to limit the region an object can be dragged in if the region is an irregular shape. I've tried with the 'set bounds' command and tried making a shape out of rectangles - but no joy.
View 2 Replies
Jan 18, 2010
Let'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
View 5 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
Apr 12, 2011
I am trying to achieve a pinch zoom effect on an image dynamically added to the stage via actionscript.
the images natural size is 2048x and onload is scaled to 1024x
when the pinch zoom is performed it calls the function below.
the problem i am trying to solve (and have tried numerous things) is to ONLY have the image scale between the two sizes as mentioned above.
scale between 1024x and 2048x and not go larger or smaller than.
[Code]...
View 2 Replies
Nov 8, 2011
I have a modal dialog with a flash video on it and I'm using the jQuery draggable plugin to make it draggable. On Chrome, it doesn't let me play the video (when I click on the play button it does nothing, though I can drag the div around if I hold down the mouse). On Firefox, the video will play, but the mouse gets "stuck" to the div and the div follows it around. Is there some easy way to prevent dragging on the flash div?
View 1 Replies