ActionScript 1/2 :: .hittest Not Finding Target
Apr 20, 2010
i have a game in which the character shoots bullets and kills enemies and whatnot. Now, i am trying to get the bullet to disappear when it collides with a wall.[code]when the bullet goes out of bounds, the bullet disappears, but when it hits the enemy or wall, it seems that the collision is not detected. I have checked each instance name and linkage, but have so far come up with nothing.
View 10 Replies
Similar Posts:
May 5, 2010
I have a line dynamically drawn in a coordinatesystem. The line is drawn by the user. Now I wonder if there is a way to find out where the line crosses the y-axis. I know about hittest but how can I get exacltly where (x- and y-coordinates) for the hitpoint?
View 0 Replies
Aug 29, 2011
I've got 30 movie clips on the stage and I want to see if any of them are overlapping a drop point I have at the bottom (i.e., if any of them have been "dropped off".)I could say dropPoint.hitTestObject(obj1) and then dropPoint.hitTestObject(obj2). (Assuming that because of the object's names there is is no way to do a for loop). But that's a lot of code.It would be way easier if I could just say "What object is overlapping dropPoint?" instead of "Is object 1 overlapping dropPoint? No? Well, is object 2 overlapping dropPoint?" etc.
View 4 Replies
Jul 2, 2010
I have an object (a Loader) that you can click on, resulting in a MouseEvent. Clicking on the Loader moves it, which I do by modifying e.currentTarget.x in the MouseEvent function, a la:
private function onClick(e:MouseEvent):void {
e.currentTarget.x = 0 - (e.currentTarget.width/2);
}
The problem is, I also want to change the ChildIndex of the target. I tried this:
private function onClick(e:MouseEvent):void {
e.currentTarget.x = 0 - (e.currentTarget.width/2);
canvas.setChildIndex(e.currentTarget, 10);
}
But that results in a compile error: "Error Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. at line 85 in Rotation.as"
I've noticed that sometimes I need to refer to the target as e.currentTarget.loader, so I tried that (canvas.setChildIndex(e.currentTarget.loader, 10);), but I get an error when I run it: "ReferenceError: Error #1069: Property loader not found on flash.display.Loader and there is no default value. at Rotation/onClick()". What's the proper way for me to get the target so I can apply setChildIndex?
View 2 Replies
Apr 29, 2009
Basically the code creates 3 sasquatches. When you click on the sasquatch it displays "you be dead sucka!", well, only ONE of the 3 sasquatches are registering hits, and the one that does traces "you be dead" 4 times.
package{
import flash.display.*;
import flash.events.*;
[code].....
View 9 Replies
Jun 7, 2010
[Code]..
I want to use the above code (obviously with more meat inside of it) on multiple instances of the same symbol, but when I name the instances "wall" only one of them actually performs the hitTest. Is there a way to pull this off without having to perform a hitTest on every instance?
View 0 Replies
Dec 7, 2009
This is my first AS3 post, I have recently taken the step from AS2. I am displaying an image from an XMLList using event.target.name. I need to access it's index number in the list to set to a variable.Here is the code:
thumbLoader.addEventListener(MouseEvent.CLICK, showPicture);
function showPicture(event:MouseEvent):void
imageLoader.load(new URLRequest(event.target.name));
[code].......
View 3 Replies
Aug 10, 2011
I'm trying to get the id of the target in showMe(). For example, when I click button or image panel's showMe() function executes first. Here I want to capture the button/image's id.
private function init():void
{
pnl.addEventListener(MouseEvent.MOUSE_DOWN,showMe);
}
[code]....
View 2 Replies
Jan 15, 2009
i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).
View 1 Replies
Sep 29, 2003
On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?
View 1 Replies
Feb 8, 2010
i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
[code].....
View 1 Replies
Nov 28, 2011
What is the difference between target and currenttarget in flex?What is the difference between Target and Current Target in Flex especially in mouse events.
View 2 Replies
Aug 30, 2010
qi have a movieclip which is added to the stage:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()
i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Mar 14, 2005
i don't know why this isn't working.i got a button. and when it's pressed, i need it to go and play a frame in a movie clip. i'll test it and then when i click on it, i get this:
Target not found: Target="whoweare" Base="_level0.instance20.instance48.instance49"
this is the code that i am using:
on (press) {
tellTarget ("whoweare") {
gotoAndPlay (51);
}
}
View 14 Replies
Feb 16, 2005
so, i'm making an animated rollover, and i get an output error that says this:
Target not found: Target="_root.icon01" Base="_level0"
i have no idea what the base="_level0" means.
View 1 Replies
Feb 8, 2008
finding a good swf to fla converter. I would love a trial version that lets me actually see the action script.
View 1 Replies
Mar 7, 2011
I need to find an instance of a movieclip that is on my flash file. It is really big and uses a lot of memory. It says on the number of times used that there is one instance of the object on the flash file, but I can't find it. I thought I deleted them all but there must be one left. How do I go about finding it? It's a really large flash file with many layers, and I don't want to just delete the library file. Is there any way I can find where the object is placed in my file?
View 2 Replies
Apr 18, 2011
I'd like to use the x and y mouse coordinates as variables in a program. I'm very new to Flash and ActionScript and I'm not even sure which classes I need to import or which listeners or handlers I need to use.
View 1 Replies
Oct 24, 2011
I am interested in finding a good swf to fla converter. I would love a trial version that lets me actually see the action script.
View 2 Replies
Oct 16, 2009
We have a client server architecture where a C++ server talks to Flash clients. I'm developing the server and would like to send through tcp an xy coord to simulate a button press where the receiving flash client would find the topmost visible object at that coord and send a mouse event to it such that we could simulate play without a human present. I'm told this is incredibly difficult, but it seems to me that there must be a way to do this. Am I off the mark? Or is there a mechanism in flash to iterate through all objects regardless of parent child relationships to find a visible button at an x, y coord and signal a press event?
View 2 Replies
Feb 11, 2011
I am studying CS5 but I can't find help files or tutorials... is everything online now? Where should I go for help?
View 3 Replies
Dec 13, 2011
This should be a simple one. I am running an IF statement that needs to check the 5th value in a pre-populated array. I'm finding it hard to find the right method of searching the array.
[Code]....
indexOf seems to just return where the value is...but I already know where it is! I just want to know WHAT it is! There will also be values that are exactly the same in other positions in the array. I have to focus in specifically on the 5th value.
View 3 Replies
Sep 2, 2010
I have a flash app hosted at The contents of that crossdomain.xml file are as follows:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
[code].....
View 2 Replies
Mar 18, 2011
I need to break a number down to be represented by a randomly ordered sequence of 2s and 3s.[code]I'm currently doing this with a loop in ActionScript 3 but have been looking into the possibility of using some kind of mathematical formula to save me a few lines of code. I'm a bit of a sop when it comes to Math and I've not yet found anything suitable.
View 4 Replies
Jan 8, 2009
At some point I will have created a MC on the stage. Later on, I want to put a different on in its place. The original MC may, or may not, be there.So I need to first check and see if it is there, whack it if it is, then add my new one.I know the name of the variable I used to create the MC, but I think the problem is I did this from INSIDE another clip. When I am trying to find it and remove it, I am outside that clip, so I don't think the main timeline knows of that variable. So when I try:if(ribbonEGM) removeChild(ribbonEGM);[code]How can I test and remove the ribbonEGM clip from the main timeline?
View 9 Replies
Jun 25, 2009
Does anybody know if there is a command to say: x= biggest value out of a,b,c,d,e ( without using an if )
View 2 Replies
Jun 30, 2009
I have to find a node value in my xml, and where is this childnode there to reading the block.
[Code]...
View 0 Replies
Oct 6, 2011
I have made a few posts now, and I'd like to especially Prid for not only answering them, but for giving me guidance on how to learn AS2. I am progressing very nicely, and have made a couple of simple games without any tutorials, but theres one thing I couldn't find. I have this character which can move, up and down, left and right. I also have an enemy trying to shoot at him. However, this enemy needs to know where the character is. I already have the shooting code (Prid), but it was for shooting in the direction of the mouse. What I need now is to replace the bit of code that finds the mouse coordinates with code that finds the coordinates of the player.
The shooting code is on the frame (doubt that is important to say, but still) and the instance AND name of the Character is, well, Character. So basically, I need a code to calculate coordinates of a movie clip that does not have a fixed position. Oh and one more thing, should I post simple stuff like this in the beginner section, because I've seen waaay more complicated stuff there than in the AS2 section.
View 9 Replies
Feb 4, 2012
My main loads an external swf. Then it creates a bunch of ball movie clips on the stage. I need to reference the content from labeled frames in the external swf. In AS2 all you had to do was use _level.
View 6 Replies
Nov 24, 2004
I am having trouble in finding target in a drag drop scenario. I have a movie placeholder named onepic1 and i load a movie using
Code:
onepic1.loadMovie(this.img1lnk);
[Code].....
View 1 Replies