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


Similar Posts:


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

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 :: DrawRoundRect - Get A Smaller Rectangle Than That Size

Aug 1, 2011

I'm trying to create a custom button with ActionScript 3.0. I'm suing a round rect as background, but I have a problem with it size. This is my custom button class:

[Code]...

I don't know why when I use a size of (40, 20) I get a smaller rectangle than that size.

View 3 Replies

ActionScript 3.0 :: Split Rectangle Into N Smaller Rectangles And Then Recombine?

Aug 23, 2010

We have a 100 by 100 px square.

How would one split this up into N number of random x/y rectangles?

And more crazy, how could you then position these back in order?

I checked out 2d Packing but its not really what im after.

View 0 Replies

ActionScript 2.0 :: Grid - Makes A Big Rectangle Of Smaller Squares?

Mar 14, 2004

I am trying to make a Grid that is equal to the width and the height of the flash movie. I have a movieclip called box which is 30x30, and want it to repead along the x to form columns and along the y to form rows so that it makes a big rectangle of smaller squares. For some reason it looks like this:

+
+
+
++++++++++++++

Instead of:

++++++++++++++
++++++++++++++
++++++++++++++
++++++++++++++

Here is my code:

Code:
onLoad = function () {
boxWidth = box._width;[code]...

View 5 Replies

ActionScript 2.0 :: Drawing API - Draw Rectangle By Dragging Mouse On Canvas

May 10, 2005

I need to to incorporate a functionality where the user can use his mouse to draw a rectangle by dragging his mouse over the canvas - much like the Rectangle Drawing Tool in the Flash Authoring environment. The requirement is something like a rubberband tool where the user can define a portion of a map by drawing a rectangle over it. The coordinates needs to be captured.

View 1 Replies

ActionScript 2.0 :: Drawing API - Draw Rectangle By Dragging Mouse On Canvas?

May 10, 2005

I need to to incorporate a functionality where the user can use his mouse to draw a rectangle by dragging his mouse over the canvas - much like the Rectangle Drawing Tool in the Flash Authoring environment. The requirement is something like a rubberband tool where the user can define a portion of a map by drawing a rectangle over it. The coordinates needs to be captured. Can anyone help me with the actionscript.

View 1 Replies

ActionScript 3.0 :: ScrollPane Component - Draw A Rectangle On A Movie Clip(board_mc) By Dragging Mouse Over It

Mar 15, 2010

I need t draw a rectangle on a movie clip(board_mc) by dragging mouse over it......It works fine till here but I want to put the movie clip(board_mc) in scrollpane.
but after doing so the code doesnot work....can u plz guide me how to make this code work after placing the movie clip (board_mc) in scrollpane(say board_scp).

[Code]...

View 5 Replies

ActionScript 2.0 :: Photo Gallery - Make The Image Window Smaller And The Overall Movie Smaller?

Jun 25, 2004

I found this really neat photo gallery on flashkit but there is no support or readme included. how to size this thing.. the AS code does have comments but I am not a coder.I'd like to make the image window smaller and the overall movie smaller. 325x325 or so

View 10 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







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