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


Similar Posts:


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 3.0 :: Define A Singleton Object?

Dec 4, 2010

How can I define my own global function which will be accessible throughout the whole package or better, program? Alternatively, how can I define a singleton object? Should I use static?

View 3 Replies

ActionScript 2.0 :: Define A Dynamic Object Name?

Apr 6, 2006

i am trying to define a dynamic object name.. here my code, but i guess it is wrong.

PHP Code:

i = 0 
var knobListen = "knob"+i;
var knobListen:Object = new Object();
};
//add the event listener to the knob
myKnob_mc.addEventListener("onRotate", knobListen) 

View 3 Replies

Flash :: Define Boundaries For A Drag-able Object?

May 18, 2011

I'm making an image revealer in flash, but I can't wrap my head around how to constrain the slider bar to the area_mc. Mainly in the mouseMoveHandler. Can someone please give me some pointers?[code]...

View 1 Replies

Actionscript 3 :: Define Shared Object Size?

Jul 3, 2011

I want to let the user save some bigger data in a shared object by choice. Is it possible to define the size the user needs to allow?
I'ld like to set the minimum to at least 10 MB to have some extra space for future usage.

View 1 Replies

ActionScript 2.0 :: Define Layer In Which New Object Would Be Crated?

Mar 4, 2006

I intended to write a script that would create a dynamic guided character motion. The drawing API tut gave me an idea how to do it. I thought I'll write a script that would draw a line (or a curve) and would put it into guided motion layer. So I just wrote it by the tutorial and put it into guided motion layer. Yeah, that was naive.So how do you define where (layer) the script would draw curve/line? How do you define the layer in which the new object would be crated?

View 7 Replies

ActionScript 3.0 :: Define Alias For Object In Code?

Aug 13, 2010

Don't know if alias is the right word here but I would like to replace a long target path with short variable to make my code more readable/managable.So I have the following (working) code but it's getting really complicated :

Code:
function scaleUp(e:Event)
{

[code]......

View 3 Replies

ActionScript 3.0 :: Changing Alpha Of Object - How To Define Property

Aug 15, 2009

I am very new to Flash and I have the following script:
mouseInterval = setInterval(changeAlpha,10);
function changeAlpha(){ fader_mc.alpha = Math.round(root.mouseX/550*100) }
This is simply to change the Alpha of my object as I change the X value of the mouse cursor. I keep getting the following error message:
1120: Access of undefined property mouseInterval

View 5 Replies

Actionscript :: Flex - Use A Variable To Define The Name Of An Instantiated Object?

Apr 20, 2010

Essentially this is what I want to accomplish, however it doesn't work like this. Is there any solution: - The problem is I can't dynamically name a new object..

import views.printingView;
public function initComponent(o:Array):void{
SomeObject::Array = o;

[Code].....

View 1 Replies

Flash :: Reference To Object - Nor Tracing A Value Define Outside The Function

Mar 18, 2011

I have object in which I have rectangle on one layer and following code on another layer:

[Code]...

And Object(this).play() or checking for current frame doesn't work, nor tracing a value define outside the function. How shall I reffer to the movieclip that events is called from?

View 2 Replies

ActionScript 3.0 :: Define A Field Inside A Value Object With Limited Options

Apr 22, 2011

I have value object that one of its field is meant to be filled trough a dropdown chooser. I'm very new to flex so I'm not sure what is the best way to maintain this field.
 
Should I make it a simple string in the value object and a table in the DB, and each time I have the dropdown to send a request to read it from the DB? That what I would have done with JS but in flash I thinkl it might be better to somehow keep that information in the flex app instead of keep asking the server to send the names every time.
 
The field has about six options and it is choosing htat field happens a lot during work with the app.

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

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







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