ActionScript 2.0 :: Hittest - MC Movement Works Only When The Y Position Of The Mouse Is Over The 300 Px?

Jan 21, 2004

Ive got a code to move a MC on the main stage together with the mouse, in the the X axis,. difficult to explain. But now the client wants that this MC movement works only when the Y position of the mouse is over the 300 px. I thought I need a hit test or something elese. Please help. Here is the whole code.

[Code]....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: HitTest For Mouse Position Over A Bitmap Inside A MovieClip?

Dec 1, 2009

This seems like it should be simple, but... I've been trying to figure out how to do the following, and I can't seem to make it work. It all works except for the hit test part. I have a working drag and drop application. I need something different to happen when the user drops an object while the mouse x,y is, or is not over a certain (very irregularly shaped) bitmap inside a movieClip. how to do this? I have found some complicated ways to hit test between 2 bitmaps, but not 1 bitmap and mouse x,y.

View 3 Replies

ActionScript 2.0 :: Simulate 3D Navigation Which Changes Movement Depending Of X / Y Mouse Position

Jan 30, 2007

I am trying to simulate a 3D navigation which changes the movement depending of the x and y mouse position.url...Does anyone know where I can find a tutorial step by step for it or something similar?

View 1 Replies

ActionScript 3.0 :: Draw Motion Guide/path For A Mouse Position Based Movement?

Mar 22, 2011

Is it possible to draw motion guide/path for a mouse position based movement?

For example if I have path the is like letter H. I would need to write many clauses/conditions for the borders of the movement. It would be a LOT easier if there would be some solution that makes the object always to stay on the defined path when moving..

View 2 Replies

ActionScript 3.0 :: Stopping Movement After Hittest?

Jan 29, 2011

I am trying to create a sort of RPG. I currently have four way directional movement working, but I'm having difficulty figuring out code to make the character stop moving when he touches a wall, and them move again when you press a different key.

Normally i wouldn't find this difficult, except most of the walls are angled, not straight lines. I'm using hitTestPoint for collision detection, and that works just fine. I just don't know good code for making the character stop.

View 2 Replies

ActionScript 2.0 :: Flowing Mc Movement Opposite Of Mouse Movement

Feb 12, 2003

I have a mc (fStrip) which looks like a piece of filmstrip with thumbnail images in it. I want this mc to move when the users mouse is positioned over it, but I only want it to move only along it's x-axis and in a direction opposite that of the mouse. And I want it to move or flow smoothly.

I've been trying to figure this out (see my lame attempt below) but without much luck.

onClipEvent (mouseMove) {
buffer=20 //movement buffer
mousePos=_root.fStrip._xmouse //store mouse position
if (mymouse!=_root.fStrip._xmouse){ //if the mouse has moved

[Code].....

View 3 Replies

ActionScript 2.0 :: Hittest Only Works Once?

Jan 26, 2010

when i make this script:

onEnterFrame = function(){
if(ss.hitTest(_root.c2)){
_root.ss._x = -49.4;
}
}

it only does go to cords -49.4 once, after ss have hit c2 once it doesn't react when it hits c2 again!

View 9 Replies

ActionScript 3.0 :: HitTest Works But Also Returns Error

Sep 5, 2009

Perhaps I should leave well enough alone, but it bugs me that my hitTest gives me an error message even though it seems to work as intended. I have two movieClips running side by side. The second clip, the hitTest object is actually in an array that I keep pushing every second.

[Code]...
 
I have tried to trace cars[i].name and it returns "instance XXX" instead of what I would have expected, which would have been something like cars1, cars2, etc... If that is creating the error, I don't know how to fix it. I have thought also that perhaps the array itself is being referenced, but again I wouldn't know how to change it.

View 11 Replies

ActionScript 2.0 :: HitTest Function Only Works On Y Axis

Oct 14, 2003

My hitTest function only works on the y-axis
This is the code....
onClipEvent (enterFrame) {
// _root.speed = speed;
if (Key.isDown(Key.UP)) {
speed += 3;
[Code] .....

View 1 Replies

ActionScript 2.0 :: Bouncing Off Walls - Stopping Movement When Hittest Occurs

Dec 14, 2003

If you take a look at this site Game then you will see that when you hit the walls or boundrys you "bounce" off them. I have accomplished stopping movement when hittest occurs but how shall I get the car to "bounce" off the walls. It would be great if you could supply the full code as I am not a great coder.

View 1 Replies

Flash8 HitTest Works Wierd With Rotating Objects?

Dec 29, 2009

How would i make hitTest work better with a rotating object(AS2). Becase i have a circle and it if gets near the rotating object (actually pretty far away) it starts the script,(new x and y)

I think thats the rotation script, becuase i took a break for like 4 days becuase it was irritating.

View 1 Replies

ActionScript 3.0 :: Perform A HitTest That Only Works On Children With A Certain Depth?

Feb 27, 2012

I have a problem with the getChildIndex() method. I have an array that stores multiple children and I want to perform a hitTest that only works on children with a certain depth, with one that is lower than the other hitTest "partner". Therefore I want to check the depth of that certain child.I tried to trace the depth, but I get crazy errors doing that. No matter if I do it from the child itself, or from the Document Class.

trace(getChildIndex(foes[7][1][1]))

[7] is the current level, [1] is the type of child and the second [1] is the child itself called [Object EnGob]. I put it there by the push() command.

View 3 Replies

ActionScript 3.0 :: Flash Hittest Only Works On Last Object In Array

Mar 24, 2012

For days now I have been trying to get this hit test to work and which ever way I try it, it always comes back to the same result. I get a hit on the last item I pushed into my array but none on the previous items I pushed in. Also if I put a .sort() on the array it only gives a hit on the last item of the array, no matter which one I push in.

The idea is that I want to drag and drop objects onto the stage, they may not overlap so I need a hit test on the objects so I can make them undroppable when the hit test is true.

This is the part I have for dragging the objects to the stage, and adding them to arrays for the hit test.

Code:
private function onClickDragBuilding1ToGameField(e:MouseEvent):void{
building1Placeholder.x = mouseX-25;
building1Placeholder.y = mouseY-25;

[Code]...

Now if I run this I can add the object to the stage just fine no errors or other issues but the hit test only works on the last object I added to the stage/array and not the previous object I added to the stage/array.

Sso I drag the first object to the stage. (no other object are available yet so nothing happens, this is as it should be) Then I drag a second object to the stage, this reacts to the first object and returns the hit test as true. (Also great and working as it should.) Then I drag a 3th object to the stage, this reacts to the 2nd object I dragged just fine and return a true value, but it does not react to the 1 object I dragged onto the stage. Then when I drag a 4th object to the stage it will react to the 3th object I added, but not the 1st ad 2nd object.

View 4 Replies

ActionScript 2.0 :: Get HitTest Position Of Th Object?

May 26, 2010

My Question is how i deduct the position of the hitTest Objecti mean to say which angle he hit X Y and after hiting it must be goo that angle

here is my code
import mx.transitions.Tween;
import mx.transitions.easing.*;

[code]......

View 4 Replies

ActionScript 2.0 :: Hittest - Drag To Defined Y Position?

Aug 29, 2004

i got 4 movie's on main (category0_mc, category1_mc, category2_mc and category3_mc) the _y position of these 4 movie's is variable.....

i want it so that when i start drag "categorie0_mc" you only can drag to (category1_mc, category2_mc and category3_mc) and when release "categorie0_mc" change _y position with the other categorie movie

View 1 Replies

ActionScript 2.0 :: Hittest -- Drag To Defined Y Position?

Aug 29, 2004

i got 4 movie's on main (category0_mc, category1_mc, category2_mc and category3_mc) the _y position of these 4 movie's is variable.....i want it so that when i start drag "categorie0_mc" you only can drag to (category1_mc, category2_mc and category3_mc) and when release "categorie0_mc" change _y position with the other categorie movie.

View 1 Replies

Professional :: Auto-Hide On Mouse Movement Rather Than Mouse Over?

Apr 12, 2010

Im looking for a quick solution (if its out there) using the autohide feature using the FLV Playback Component. 

Current situation: Using ActionScript 2. The FLV component fills the stage. Autohide is set to true.

It looks to me that since the video fills the stage, the skin will not hide. What I would like to do is have the skin fade out if the mouse doesnt move for a certain period of time.

View 1 Replies

ActionScript 2.0 :: Mouse X Position To Control Movie Position?

Feb 1, 2006

Basically the x position of the mouse should control the play position of a movie. Do I need something like an event handler (I'm not sure exactly what these do, but I've seen similar scripts that seem to use them).

View 2 Replies

IDE :: Cursor Position Not Mouse Position In Input Text Box

Nov 12, 2009

I have an Input Text area that users can edit and then submit. I need to be able to show, on screen, the cursor's current position as they type. I don't need to know where the mouse is but all work-arounds I've found so far can only tell me the mouse position. The font for the text is 'courier' or 'courier new' and the Input Text area is scrollable.

View 8 Replies

ActionScript 3.0 :: Random Movement In X Position?

Nov 13, 2011

I wanted to built an enemy that is able to move on stage randomly in xposition and perhaps able to detect my character within the detectable zone and chase after me.. but currently I just wanted to make the enemy move randomly in x-position for starter.
  
It is my first time making and enemy with AI, but I'm just wasn't sure where to begin, I have used a fairy easy script to animated the movieclip in the beginning but got stucks whenever it reaches 960 or below 0 of the stage
 
addEventListener(Event.ENTER_FRAME,initGames);
function initGames(e:Event):void{
moveEnemy();
}

[Code].....

View 8 Replies

ActionScript 2.0 :: MC Movement - Rotation And Position

Apr 24, 2005

I'm having a problem with a little movement script I wrote for a MC I have. I believe it either has to do with variable scoping, or with a coordinate system problem. (If I change the xPos and yPos in the onClipEvent (load) to 0,0...then the MC starts in the middle of the field (MC) I'm trying to move it inside of.) Basically...the ActionScript you see below is a part of the "Player" MC...who is supposed to move around a "field" MC I have.

I was assuming setting xPos and yPos to 0 would have the Player MC starting at the very top left of the entire screen...which instead it starts in the middle of the "field" MC.) Also - When I press the different arrow keys...the Player MC jumps around to different locations...but once at the new location the movement (in a single direction) works okay.

[Code]...

View 11 Replies

ActionScript 2.0 :: Tween From One Position To Mouse Position?

Mar 28, 2010

tween from one position to mouse position

View 1 Replies

ActionScript 3.0 :: Stop The Movement Of A MC At Original Position?

Apr 21, 2010

I have a movieclip instance named "ground" i have it set up so that the ground moves constantly to the left as a scrolling BG. what I want is that when the user presses the "space" button, the ground moves down then back up in a a parabolic path. and it does. but I want the movieclip to stop moving vertically(make dy equal to zero) when it returns to its original y position. how can this be achieved?

Code:
package{
import flash.display.*;

[code].....

View 2 Replies

ActionScript 2.0 :: MovieClip Movement / Rotation And Position

Apr 24, 2005

I'm having a problem with a little movement script I wrote for a MC I have. I believe it either has to do with variable scoping, or with a coordinate system problem. (If I change the xPos and yPos in the onClipEvent (load) to 0,0...then the MC starts in the middle of the field (MC) I'm trying to move it inside of.) Basically...the ActionScript you see below is a part of the "Player" MC...who is supposed to move around a "field" MC I have.

(I was assuming setting xPos and yPos to 0 would have the Player MC starting at the very top left of the entire screen...which instead it starts in the middle of the "field" MC.) Also - When I press the different arrow keys...the Player MC jumps around to different locations...but once at the new location the movement (in a single direction) works okay. I've attached the .swf.

onClipEvent (load) {
speed = 2;
xPos = 0;
yPos = 0;
this._x = xPos;
this._y = yPos;
[Code] .....

View 11 Replies

ActionScript 1/2 :: Focus On Mouse Position When Zooming Movie Clip Using Mouse Wheel?

Oct 29, 2009

I have a map application that when I use the mouse wheel the map will scale up or scale down. The next thing I want to do is to focus on the mouse pointer while zooming on the part of the map.

I have this code...

function focusMousePosition(){    onMouseMove = function (){        Stage.width = _root._xmouse;        Stage.height = _root._ymouse;        updateAfterEvent();    }}
var mouseWheelListener = new Object();var wheelNum:Number;
mouseWheelListener.onMouseWheel = function(wheelNum){    focusMousePosition();    if (wheelNum > 0){        map._xscale *= 0.9;        map._yscale *= 0.9;    }else{        map._xscale *= 1.1;        map._yscale *= 1.1;    }}Mouse.addListener(mouseWheelListener);

View 3 Replies

ActionScript 3.0 :: Running Movement Of The Character And The Second Frame Is On Standing Position

Dec 20, 2010

RIGHTNOW, Im doing my game development but I have problem based on my game control.this is my question..
 
I have two frames. the first frame is on running movement of the character and the second frame is on standing position.This two frames has only one kind of character,but I seperated the two movement in two frames witch are running and standing positon.my problem is how can I do the mouseEvent,if onclick the character will continue on running and if on release the character will do is to standing position.

View 2 Replies

ActionScript 2.0 :: Movement - Movie Clip Mc_main Is Not Always Going To Start In The Same Position

Sep 14, 2006

I just followed this tutorial and I did get how it all worked.. and i got my movie clip flying arround the stage. Then when i tried to apply it to a little project i'm working on, i couldn't get it working. I have a movie clip called mc_main and when i click a button I want it to move - using easing - to a new position on the stage. In the first frame of my timeline i have put this AS:

[Code]....

View 7 Replies

ActionScript 2.0 :: How To Avoid Mouse HitTest

Nov 24, 2003

I am creating a menu with nested MCs, of course, and the parent MC is using a RollOver action. The problem with that is: all other nested MC's RollOver action are not detected. I know you can use a mouse hitTest as a work-around i.e.:
Code:
onEnterFrame = function(){
if(this.hitTest(_xmouse,_ymouse,true)){
//do whatever
}}
But I'd like to avoid using that if possible.

View 7 Replies

ActionScript 2.0 :: How To Avoid A Mouse HitTest()

Nov 24, 2003

im creating a menu with nested MCs, of course, and the parent MC is using a RollOver action. The problem with that is: all other nested MC's RollOver action are not detected. I know you can use a mouse hitTest as a work-around ie:

Code:
onEnterFrame = function(){
if(this.hitTest(_xmouse,_ymouse,true)){
//do whatever
}
}

but i'd like to avoid using that if possible.

View 7 Replies

ActionScript 3.0 :: Zoom To Mouse Position Using Mouse Wheel?

Mar 9, 2010

Code:

addEventListener(MouseEvent.MOUSE_WHEEL,mouseWheel);
function mouseWheel(event:MouseEvent) {
Map.scaleX = Map.scaleX + event.delta*.01;
Map.scaleY = Map.scaleX;
}

The problem with this code is that it scales from the registration point (0,0). Due to the other transformations I'm doing to this image at various times, it isn't possible to move the registration point. The image is larger than the stage and the user is able to drag it around. I want the mouse wheel to zoom in on the place the mouse is hovering over (or at a minimum...the center of the "view" they have...aka the stage)I tried doing this:

Code:
internalPoint = new Point(Map.mouseX, Map.mouseY);
externalPoint = new Point(stage.mouseX, stage.mouseY);
var matrix:Matrix = Map.transform.matrix;

[code]....

Which, incidentally, I'm using that whole portion of code to zoom into the state they will be in when they use the mouse wheel.

View 1 Replies







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