ActionScript 2.0 :: Defining A Rectangle Boundary

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


Similar Posts:


ActionScript 3.0 :: Dragging Within Boundary Of Smaller Rectangle

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

ActionScript 2.0 :: Drag Inside A Boundary (not A Rectangle)

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

ActionScript 3.0 :: Rectangle - How To Make Boundary Fill In Flash

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

Actionscript 3 :: Scrollbar With Sprite And Rectangle Won't Move Text, Just The Rectangle It's Painted On?

Mar 8, 2010

For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.So I needed to get a Scrollbar, which I got hereThe thing is, it works with Sprites.After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.

So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?

View 1 Replies

Draw Rectangle Should See Little Bold Circle To Indicate A Perfect Rectangle

May 20, 2009

I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!

View 2 Replies

ActionScript 3.0 :: Convert Rectangle To Curved Rectangle?

Aug 2, 2011

I am trying to convert a rectangle(actually multiple rectangles) to a curved rectangle. I think it should be pretty easy but I guess i am stupid. Basically I would have a start position and stop position (many of these), and they would be converted to curved rectangles and follow in a cicrle around.

View 0 Replies

ActionScript 3.0 :: Creating A Rectangle Inside Of A Rectangle?

Jun 26, 2010

I would like to create a rectangle inside of a rectangle, starting approximately 15% inward from the right side of the other rectangle.

I know how to create rectangles with:

Code:
var newHotRect:MovieClip = new MovieClip();
newHotRect.graphics.beginFill(0x00FF00);
newHotRect.graphics.drawRect(0, 0, 100, 100);
addChild(newHotRect);

But how would I make another rectangle on top of that (the black one pictured) that is approximately 15% from the right?

I toyed around with .right, and .bottomright with no success. Can anyone lead me in the right direction? or even finding the x and y of the upper right or bottom right side of a rectangle?

View 10 Replies

ActionScript 3.0 :: Rectangle To Rectangle Collision Response?

May 20, 2011

how to respond when a rectangle hits another rectangle? I already know how to detect the collision, I just don't know how to respond to it. I'm just trying making a simple side-scrolling platform game where I have platforms I can walk on and bump against on all sides. I have searched everywhere and just can't find the tutorials I'm looking for.

View 6 Replies

ActionScript 2.0 :: X And Y Boundary When Scrolling?

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

Flex :: Dragged TitleWindow Within App Boundary?

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

AS3 :: Flash - Set Boundary Limit For MovieClip?

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

ActionScript 3.0 :: Define Boundary For An Object

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

ActionScript 2.0 :: 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, it couldn't move any more?

View 1 Replies

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

ActionScript 2.0 :: Stop One Movieclip From Going Outside The Boundary Of Another?

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

ActionScript 2.0 :: Using A Non Rectangular Drag Boundary?

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

ActionScript 2.0 :: Movie Clip Boundary?

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

ActionScript 3.0 :: Bounce Not Rendering At Boundary

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

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

ActionScript 2.0 :: (flash Mx) 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:

[Code]....

View 6 Replies

ActionScript 2.0 :: Boundary Coordinates Not Working?

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

ActionScript 2.0 :: Boundary For Infinite Menu?

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

ActionScript 3.0 :: Fit Many Display Objects Of Different Sizes Within A Boundary?

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

ActionScript 3.0 :: Restrict Boundary On Drag And Drop?

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

Actionscript 3 :: Fit Text Into Circle Or Oval Boundary

Feb 1, 2012

How can i fit text inside Circular or Oval boundaries (not rectangular boundary)?

View 1 Replies

Actionscript 3.0 :: Using Shape As Object Movement Boundary?

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

ActionScript 2.0 :: Drag Class: Set Boundary For Movieclip?

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

ActionScript 3.0 :: Pinch Zoom Scaling Boundary?

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

ActionScript 3.0 :: Pool Ball Physics With The Boundary Be A 3d Sphere

Nov 11, 2009

I'm creating a ball bouncing in 3d. My problem is that I have a square boundaries. top,bottom, front, back. I tried get the the distance ( of the sphere/radius) but went I * vx , vy , vz by 1 or -1. One of the position is - while the other two might by positive. I need pool ball physics with the boundary be a 3d sphere.

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved