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


Similar Posts:


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

Button In A Different Shape Than Rectangular?

Aug 2, 2009

is it possible to make button in a different shape for example i have a figure that i cut from image on a transparent background an i was wonder if it is possible to make that person in to a button but just that person not the transparent background.

View 1 Replies

ActionScript 3.0 :: Non-Rectangular Buttons With Images?

Feb 11, 2009

is it possible to create a non-square "button" in flash cs4 programmatically using as3?

Using a xml document, i'm trying to be able to retrieve a png file with transparency, and have said transparent area's be not clickable.

Long story short, I'm creating a map with a bunch of clickable areas. These areas are non-rectangular and I need them to not obscure other area's which would be in their rectangle. I need this to be done programmatically since the area's are going to be dynamic as is the data attached to them.

fyi: I have a fairly good grasp of OOP, so don't be afraid to post up complex instructions.

View 8 Replies

ActionScript 3.0 :: Fit Bitmap To Non Rectangular MovieClip?

Nov 27, 2009

I'm loading bitmaps dynamically using AS3 and I'd like to fit/tile them within a movieclip. (like a texture but in 2D)

However, my movieclip is not rectangular and everything I tried resulted in the texture getting out of the boundaries of my movieclip and being displayed as a big rectangle.

View 5 Replies

ActionScript 3.0 :: Change Shape Of This Rectangular Bounding Box?

Feb 18, 2010

I have a movie clip which contains a circular image, and by default Flash CS4 gives it a rectangular bounding box. This is a problem however because I am using this movie clip as a button, so the rollover area includes the entire rectangular bounding box and not just the circular image. How can I change the shape of this rectangular bounding box?

View 2 Replies

ActionScript 1/2 :: HitTest For Rectangular MC Over Irregular Shape

Jan 15, 2010

In my app, a user must drag and release a rectangular mc object (rectx) over an irregular shape within another mc object (irregx). There are 13 rect/irreg pairs. Each obj shares an AS2 file that checks whether rectx is over irregx, and proceeds _only_ if the check is true. The script uses hitTest, on mouse release, to grab the number (x) of the rectx being dragged and checks whether it's over irregx. Right now, the check comes back true when rectx is _anywhere_ inside irregx's bounding box whether it's over the actual image or not.

I've noticed that, when the (unpressed) mouse rolls over any irregx, it's oblivious to irregx's rectangular bounding box. It only reacts when it reaches the edge of the irregular shape inside, toggling from arrow to hand at the image edges. Since the mouse knows where the irregx image boundary is, is there a simple way to tap the mouse's 'eyesight' to verify whether rectx is over the correct irregx shape (meaning not just within the bounding box, within the shape inside it)? This can't be that hard.

View 6 Replies

Flex :: Crop Image Using A Non-rectangular Shape?

Oct 30, 2009

I've been following this tutorial to crop images in flex: [URL]

At the heart of its cropping is using a method called "copyPixels". However, this method takes as one of its arguments a rectangular shape for its crop region. Are there other strategies I can use to crop it not using a rectangle.

I am going after letting the user specify the region that should be cropped using a series of points.

View 1 Replies

ActionScript 3.0 :: Specify Rectangular Region Zoom Into Video

Jul 3, 2009

If it's possible to zoom into a video? For example specify a rectangular region in the video and zoom in.

View 1 Replies

ActionScript 3.0 :: Getting The Average Pixel Value Of The Rectangular Area Behind A Mc?

Nov 28, 2009

I have a vector movie-clip of a cat. Behind it, there is a picture of a park. The picture of the park takes up the entire stage, but the cat is only 32x16. How could I use BitmapData to sample all pixels (of everything, not just the park) within the cat's bounding box (but not including the cat itself in the samples (so like the cat is invisible); also 4 pixels wider in each direction, so it would effectively be 40x24) and then return the RGB average (in hexidecimal) so that I can set a masked transparent mc in front of the cat to that value?

Basically, so it looks like the color of the cat's surroundings affect its tint, to crudely simulate global illumination in 2d.

View 1 Replies

Actionscript 3 :: Find Where A Line Collides With A Rectangular Object?

Nov 9, 2011

I am developing a game with Flixel as a base, and part of what I need is a way to check for collisions along a line (a line from point A to point B, specifically). Best way to explain this is I have a laser beam shooting from one ship to another object (or to a point in space if nothing is overlapping the line). I want the line to reach only until it hits an object. How can I determine mathematically / programatically where along a line the line is running into an object?

I could try measuring the length of the line and checking points for collision until one does, but that seems like way too much overhead to do every frame when I'm sure there is a mathematical way to determine it.

Edit: Before checking an object for collision with the line itself, I would first eliminate any objects not within the line's bounding box - defined by the x of the left-most point, the y of the top-most point, the x of the right-most point, and the y of the bottom-most point. This will limit line-collision checks to a few objects.

Edit again: My question seems to still not be fully clear, sorry. Some of the solutions would probably work, but I'm looking for a simple, preferably mathematical solution. And when I say "rectangle" I mean one whose sides are locked to the x and y axis, not a rotatable rectangle. So a line is not a rectangle of width 0 unless it's at 90 or -90 degrees (assuming 0 degrees points to the right of the screen).

View 4 Replies

ActionScript 3.0 :: Resize A Rectangular MovieClip At Run-time Dynamically?

Sep 22, 2009

I am trying to resize a rectangular MovieClip at run-time (dynamically). But, the problem is that it changes the width in both directions (left and right) from its transformation point. The same is the case with its height.

I want the width of the clip increase from left to right or decrease from right to left only.

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

ActionScript 3.0 :: Create Rectangular Box Object Through Pure Action Script.?

Jun 23, 2009

How to create rectangular Box object through pure action script ?

I think, it can be done through the libary of movie clip but I am not sure. I want to take suggestion to create rectangular box through AS script

View 6 Replies

Flex :: Determine If A Series Of Points (or Polygon) Is Within A Rectangular Region?

May 20, 2011

I have been looking at posts about determining if a point lies within a polygon or not and the answers are either too vague, abstract, or complex for me. So I am going to try to ask my question specific to what I need to do.I have a set of points that describe a non-straight line (sometimes a closed polygon). I have a rectangular "view" region. I need to determine as efficiently as possible whether any of the line segments (or polygon borders) pass through the view region.

I can't simply test each point to see if it lies within the view region. It is possible for a segment to pass through the region without any point actually inside the region (ie the line is drawn across the region).Here is an example of what I want to determine (red means the function should return true for the set of points, blue means it should return false, example uses straight lines and rectangles because I am not an artist).

Another condition I want to be able to account for (though the method/function may be a separate one), is to determine not just whether a polygon's border passes through the rectangular region, but whether the region is entirely encompassed by the polygon. The nuance here is that in the situation first described above, if I am only concerned with drawing borders, the method should return false. But in the situation described here, if I need to fill the polygon region then I need the function to return true. I currently do not need to worry about testing "donut" shaped polygons

Here is an example illustrating the nuance (the red rectangle does not have a single vertex or border segment passing through the on-screen region, but it should still be considered on-screen):For the "does any line segment or polygon border pass through or lie on screen?" problem I know I can come up with a solution (albeit perhaps not an efficient one). Even though it is more verbose, the conditions are clear to me. But the second "is polygon region on screen?"PS I have a function for determining line intersection, but it seems like overkill to use it to compare each segment to each side of the on-screen region because the on-screen region is ALWAYS a plain [0, 0, width, height] rectangle.

View 2 Replies

Actionscript 3 :: Libraries With A StartDrag() Equivalent That Has Non-rectangular Boundaries (ie: Circular)?

Jul 27, 2011

I'm just trying to avoid rolling my own dragging functionality - anyone know of any libraries out there that have a startDrag() equivalent where you can use, say, a circular radius for the drag bounds, rather than a rectangular box?

View 3 Replies

ActionScript 2.0 :: Restrict A Draggable Object To A Non-rectangular Shape (like Triangle)

Jun 23, 2007

whats the best way to restrict a draggable object to a non-rectangular shape (like triangle) I did it with hittest but i cant get it to go to the nearest point when the cursor is outside the shape...

View 5 Replies

ActionScript 3.0 :: Crop Image But With Use Of Rectangle Class Or In Rectangular Shape

Apr 17, 2009

I am having some problems regarding image crop.I am able to crop an image but with the use of rectangle class or in rectangular shape.But i would like to crop in circular shape(for example go to URL...).

View 8 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 :: 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 :: 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







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