ActionScript 2.0 :: Detect A Hit Between A Specific Object And A Certain MC?
Nov 26, 2004
ive used this code to detect a hit between a specific object and a certain MC
Code:
if(this.hitTest(_root.ufo)){
now i want to know if its possible to detect collisions with everything except (ignore) certain MCs because i only have 3 MCS i dont want it to care about , but there will be about 200 or more i want it to care for.
View 5 Replies
Similar Posts:
Apr 28, 2009
I have a MovieClip that has a bunch of MovieClips inside it. I am trying to figure out how wide the MC is at a specific y value. Not sure if there is an easy way to do this.
For an example.
Code:
OOOOOOOO
O O
O O
[code]....
This is the shape of the MC. It is not solid all the way through, it has MCs strewn about inside this outline. I am trying to figure out how wide it is from, say the second 'O' from the bottom. Left to right. The actual MC.width would be 12 'O's wide. But at that bottom portion, it would be 10 'O's wide. I'm not sure how I can do this.
View 9 Replies
Sep 30, 2010
In my Timeline I have 4 layers, each with labels on different keyframes. I have the following code, which obeys to my first layer:[code]How can I make AS3 to detect the specific "currentFrameLabel" of a named layer?
View 6 Replies
Feb 17, 2010
Is it possible to detect (dynamically) the white pixels of an image and delete them? Actually i have some images that i load on stage but they are square without the actual image be a square sized. So i want to make the hit area exactly the shape of the image and not the whit border they have.
View 2 Replies
Jul 20, 2010
Anyone knows how do i detect a mouseclick on a specific photo which is uploaded from xml?
View 3 Replies
Aug 12, 2010
I need to detect the name of any object pressed that is on the stage. This needs to be done by simply pressing the mouse on that particular object on screen.I tried looking down the Mouse.addEventListener and myObject.target route but did not get very far. Baring in mind that this needs to be done in AS2. I have found a way to do it in AS3 but could not work out how to reverese this as so it works within AS2
View 3 Replies
Mar 26, 2010
With Flash, is it possible to detect whether an object is fully ontop of another ?E.g. I have a rectangle (floor surface) and a circle (furniture).
Now I want to detect whether the circle is fully in (=over) the rectangle, and not just whether it hits the rectangle somewhere.
View 3 Replies
Nov 29, 2009
I need detect that one dragging object over another.
1 example: use hitTestObject like here link 2 example: compare coordinates of two objects.
Code:
function drag(e:MouseEvent):void {
trace(e.target.x);
e.updateAfterEvent();
}
View 1 Replies
Nov 9, 2010
when i do zoom in (by scaleX and scaleY), some of the object are shown and others disappear somewhere in the game area and on zoom out i see the whole grid again, the point is that i need to detect which objects are currently shown to the player and which aren't and hiding in the rest of the game's area.
View 7 Replies
Jul 27, 2010
How do i actually detect an object from parent(maintimeline)? I'm trying to add a listener on this loaded picture_mc such that when it's drag to this specific object, box_mc on the maintimeline, picture_mc will perform some animation.
View 1 Replies
Aug 12, 2005
I'm trying to detect when an object (a golf ball) in my game stops bouncing. I need to track it's x and y position and tell when they both equal a set figure (the hole) a hitTest wasn't working as it was detecting each ball bounce not when it stopped rolling. So when the x and y both equal a figure.
if ((this._x = -106.5) && (this 47.55)){
_root.cheer.play();
}
This doesn't seem to work.
View 5 Replies
Mar 12, 2002
1. Need to be able to allow movie_clip2 to detect movie_clip1
2. Allow movie_clip2 to follow movie_clip1 only in the _y axis
View 10 Replies
Feb 26, 2002
I need to beable to detect and object or movie and allow another object/movie to follow that the first object/move but only moving up and down ........ not on the x-axis.
View 7 Replies
Mar 16, 2009
By, let's say, another display object. I have no idea what it was called.
View 1 Replies
Feb 11, 2009
I'm trying to detect if a shared object's value has changed. Is there a way to do this? I'm using setProperty and it works fine but I need to change info the info has changed. I have tried event.changeList but it just shoots out [Objects] without giving me values. Can't it tell me a boolean to see if it has changed?
View 1 Replies
Feb 29, 2012
i have created more than one objects, now i need to access a specific objects from them.
[Code]...
View 3 Replies
Aug 24, 2009
I am trying to quickly publish a simple game in which the user has to cross through an intersection without being hit by another car. Both roads curve, so the movie clips each consist of a child movie clip symbol moving along a path on the timeline. The User's movie clip plays when the user hits the space bar, and the other movie clip is initiated everytime the main timeline loops. The user has to carefully time his spacebar so that the child movie clips do not occupy the same space on the stage at the same time.The target path to the user's car is: parkingQue.nextCar.playerCar (actually a child of a child)I am attempting the following code, but naturally it doesn't work:
parkingQue.nextCar.playerCar.addEventListener(Event.ENTER_FRAME, crash);
function crash(event:Event):void {if (parkingQue.nextCar.playerCar.hitTestObject(northBoundCar.northCar)) { trace
[code].......
View 7 Replies
Nov 5, 2010
I'm building a flash app that has some draggable buttons on it and I want them to behave like this:
You click on it, ClickEvent1 happens, You click and hold on the button, you can move it. If you release from the hold, it does NOT trigger the ClickEvent
I'm running into the logic problem of not knowing whether a user is just clicking or starting a drag event. Does anyone know any logic to get around this issue? I have thought of alternatives such as placing regions of the button that are only draggable or only clickable, but I've seen this type of functionality in other flash apps and I'm wondering how it is accomplished.
View 2 Replies
Jun 8, 2011
Is there a way I can have JavaScript/jQuery know when a Flash object has been clicked (and still have Flash process the click)?
I tried putting a table on top of the object with position: fixed and a z-index and the object set to param name='wmode' value='transparent' so I could have my JavaScript detect which column was clicked using jQuery's click(), but the clicks were never intercepted by JavaScript (Chromium Linux).
View 2 Replies
Oct 13, 2005
Right now I'm working on an advanced hitTesting engine, and What I'm trying to do here is create an engine that will detect collision with one object instead of two. That basically means that if any other objects touch this movie clip, the hitTest will return True. Right now the .fla containing the engine has nothing but a circle that can be moved using arrow keys and 8 squares that disappear when touched by the circle. Obviously, I could do something like:
if (circle.hitTest(square1)) {
do so and so
} else if (circle.hitTest(square2)) {
do this and that
} etc...
But that would be too long, since the engine has to be able to contain 100 squares without too much change in the code.
View 3 Replies
Nov 12, 2009
I'm having problem with garbage collection in a large, not-so-well-written project that I didn't start. I am getting memory leaks -- and want to make sure that all event listeners on the offending objects are removed. I've gone through the code and done what I can, but still ain't happening -- is there a way in AS3 to take an object and see IF it has an event listener, and to REMOVE that listener -- that is, to remove ALL listeners, without knowing what they are? I know if I know what the EVENT TYPE is then I can use hasEventListener() to figure out if it has a listener of that type (although the presupposes I know all the event types being used), but if I don't know the function that it's subscribing to then I can't remove it.
Or is there some other way to simply nullify an object for GC? I've changed all listeners to weak -- but I think (since the offending objects are FLVPlaybacks) that something in the flash internal setup is still listening to my object (I've gleaned this from FB 4 profiler which I've used in external mode). I would just, at this point, like to see what's going on.
View 6 Replies
Aug 30, 2004
I use something like this code to detect the speed of the movement of a dragged object
PHP Code:
if (!go) {
this["position_"+i] = this._y;
i++;[code]....
This way I can find in what direction the mouse vertically has moved and at what speed. The problem is that every once in a while the speed will be in the opposite direction. What do people use to detect the direction of the movement of the mouse?
View 2 Replies
May 7, 2009
I'm using AS 3.0, and I'm trying to change the frames inside a specific object's timeline.The change will be triggered by keyboard events, but I don't know whether to add the eventlistener to the stage or to this. Also, it doesn't seem to be responding to anytime I use a gotoAndStart() or gotoAndStop() it just ignores it completely. Is it calling the stage's timeline when I call this? It also doesn't help when i add this.gotoAndStart() or this.gotoAndStop(), so how do you change the frames outside of the main timeline?
View 3 Replies
Nov 26, 2004
I've used this code to detect a hit between a specific object and a certain MC
Code:
if(this.hitTest(_root.ufo)){
Now I want to know if its possible to detect collisions with everything except (ignore) certain MCs because I only have 3 MCS I don't want it to care about, but there will be about 200 or more I want it to care for.
View 1 Replies
Jun 7, 2006
I am having an issue with the setVolume() function. My problem is that when I set volume of a specified sound object the entire flash file is affected, meaning that all sounds are affected (The ones created by AS). Not just the single sound I specified.
Here's the line, which "mutes" the sound:
Code:
music_main.setVolume(0);
The "music_main" object is created through these lines:
Code:
music_main = new Sound();
music_main.attachSound("MAIN_THEME");
Now my problem is what I stated above. All Sound Objects created are affected by the setVolume() function. I only want to change the "music_main" object.
View 10 Replies
Jan 11, 2010
I have created a FLV video player using the AS3 flash.media.Video object (not the FLV playback component) and I am trying to listen for meta events and Cue Points embedded in the FLV video but I am not receiving any when I trace the movie. The cue points are not being created dynamically, they are in the FLV video.
Video embed code:
// Initialize net stream
nc = new NetConnection();
nc.connect (null); // Not using a media server.
[Code]....
Is there anything I am missing have wrong to capture events from my net stream?
View 2 Replies
May 7, 2011
I have this small project HERE. Right now it barely does anything but make the character move.
I move the character by using <s:Move>. Now as you can see on the link to my project page, it moves to where you point the mouse and click. I want to be able to stop the character from moving if it hits another object or in this case, the "tree". Is there a script in AS3 that will let me detect collisions or controls that are overlapping each other?
View 1 Replies
Jul 11, 2009
Can I detect the color of a pixel or an area in a Display Object?
View 2 Replies
Feb 18, 2009
I'm making a game that's similar to Pong. Basically instead of a long, skinny paddle, the paddle is wider -- but this creates some problems when hit testing.
I don't want the ball to be able to hit the side of the paddle, only the front of it (the side facing the other paddle, technically the side part). I'm basically wondering how I can run a hit test in AS3 but for only one side of the object. The object is a basic movieclip.
View 0 Replies
May 19, 2005
How to make sure the sheep will only appear on the green field on the left hand side? I use the following but they appear all over the place.
onClipEvent(load) {
_x=Math.floor(Math.random()*379+150) //where width is the width of your stage
_y=Math.floor(Math.random()*376+150) //where height is the height of your stage
}
View 1 Replies