ActionScript 2.0 :: CS3 : HitTest Code Not Working Properly?

Oct 9, 2009

I have had this problem for a long time and have not been able to fix it. I am using ActionScript 1, although if you can help me using AS2 I should be able to change it. I have a static movie clip with no code referring to it called "ship". Its center point is 275, 324.9. I have a series of planets coming down from the top of the screen and I need to check whether you "died" or not. The planets movie clips are contained inside blank movie clips that are there so thre registration point does not change. I was using the code

Code:
if(this.hitTest(275, 324.9, true)){
gotoAndPlay("gameover");
}

View 3 Replies


Similar Posts:


ActionScript 2.0 :: HitTest() - How To Properly Use It

Aug 18, 2005

I've been working on a drop-menu and my buttons are contained within a MovieClip. Problem lies with the rollOver(), rollOut() methods.

Whenever I rollOver, the buttons that are revealed dont fall unter the 'hit area' of the button that animates the movieClip. (If that made any sense)... so, after searching the forums here and stopping by Macromedia and searching their Knowledge base/Forums, I am convinced I need to use the hitTest() [MovieClip.hitTest()]I just dont know how to use this function/method, whatever you wanna call it. (What is it called BTW?)

View 7 Replies

ActionScript 2.0 :: Create An "hitTest" Script Inside A Movieclip That Is Actually Part Of That HitTest Code?

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

ActionScript 1/2 :: Can HitTest Code Reside In Symbol

Apr 30, 2010

I know that I can place a hitTest on an instance of a symbol using: onClipEvent(enterFrame){ if(this.hitTest(_root.someMC_mc))//do something } but can I place the hitTest in the symbol so that all instances of the symbol perform the hitTest?

View 3 Replies

ActionScript 2.0 :: Can HitTest Code Reside In Symbol

Apr 29, 2010

I know that I can place a hitTest on an instance of a symbol using:

onClipEvent(enterFrame){
if(this.hitTest(_root.someMC_mc))
// do something

[code].....

View 0 Replies

ActionScript 3.0 :: Can't Get This Code To Function Properly?

Jan 11, 2010

In the moveThings function, the if part is only ment to play if the cursor is over the circle (ball_mc), which follows a bit after the cursor. However, something is wrong that makes it play this part (the first if statement in the moveThings), while it's meant to play the else part in that function unless the cursor is over the circle in which case the if is true.So what is wrong? I'm assuming that it's something with

Code:
if(-20 <= (stage.mouseX - ball_mc.x) <= 20 && -20 <= (stage.mouseY - ball_mc.y) <= 20)

that makes the computer play that statement even though the cursor isn't over the circle.

View 3 Replies

ActionScript 3.0 :: Hittest Is Not Working

Apr 7, 2010

i'm trying to build this simple game for school: you've got a catapult which launches a "bullet" and you will have to aim it to hit a certain point. Now the whole catapult part and shooting the "bullet" works, but now it has to respond when it hits something, and that's where i'm stuck.

[Code]...

View 1 Replies

ActionScript 2.0 :: HitTest Is Not Working

Aug 12, 2010

I'm trying to make a hitTest between to movie clips (Let's call them J and T)[code]But nothing happens when the two movie clips collide.

View 5 Replies

ActionScript 3.0 :: Hittest Is Not Working?

Apr 7, 2010

i'm trying to build this simple game for school:you've got a catapult which launches a "bullet" and you will have to aim it to hit a certain point.Now the whole catapult part and shooting the "bullet" works, but now it has to respond when it hits something, and that's where i'm stuck.
 
I've included:
 
if (stok.kogel.hitTestObject(this.muur)) {           trace("ball hit")            }
 
but I just can't seem to get an trace back.(PS: here's the file as refference (all AS is in the catapult))

View 7 Replies

IDE :: HitTest Not Working - How To Modify

Aug 28, 2009

Why my hitTest is not working and how to modify the same in Menu1 to make it to work.

View 1 Replies

ActionScript 2.0 :: HitTest Not Working?

Jul 2, 2007

I have tried hitTest many times.The function works perfect if I run it from an example, but not if I do it myself.I attached the FLA.Also, in this demonstration I tried using the if with the ,s. I have tried with _root.mc.hitTest style.

View 1 Replies

ActionScript 2.0 :: MX Hittest Not Working With Duplicatemovie?

Sep 30, 2009

ball2 is duplicated every 3 seconds and the gravity code is on the ball2 mc. this code is on frame one of the main timeline.Why when two of the ball2 mc's are on the stage does the hit test not work on one of them?

Code:
checkX = function (dx, oldVal, newVal) {
if (_root.paddle.hitTest(_root["ball2"+i])) {

[code]........

View 4 Replies

HitTest Function Not Working With Attachmovie?

Oct 5, 2009

I can't seem to get the hitTest to work for my script shown below. I have tested using movieclips created on stage during design time and made to collide during run-time. hitTest works fine in this situation.
 
But if I use the attachmovie command and create a movie on stage during run-time, that clip cannot hitTest with other movieclips. The hitTest simply doesn't work.

The script below is basically, to create instances of enemymc, and it will fall vertically, hitting a movieclip target_mc which is placed during design-time.

var enemyTime:Number = 0;
var enemyLimit:Number = 20;
onEnterFrame = function()
{

[Code].....

View 3 Replies

ActionScript 2.0 :: Conditional With HitTest Not Working?

Feb 10, 2010

I am calling this function via onEnterFrame from another function.

ActionScript Code:
function hitCheck():Void{
or(i= 0; i < numTools; i++){

[code]....

View 4 Replies

ActionScript 3.0 :: Timeline Code And Separate AS File Code Working Together

Dec 27, 2010

Is there a way to make code on the timeline and code in a separate AS file communicate with each other?I have two buttons, a yes button and a no button.I have a confirm box which is a movie clip. In the movie clip I have the two buttons on it and code so that every time one of the buttons is clicked it runs a function.I have the rest of my code for the movie (so the code to make the confirm box appear) on a separate AS file.Is there a way I can define the functions on the movie clip and run the functions with the separate AS file?

View 7 Replies

ActionScript 2.0 :: While() Not Working Properly

Apr 2, 2004

i tried following the duplicate mc tutorial, however the part on putting the code in a frame to get it to duplicate on load doesn't seem to work for me

here's my code in the frame:

stop();
amount = 5;
while(amount>0) {

[Code]....

apparently the clip only gets duplicated once where's the problem?

View 5 Replies

ActionScript 2.0 :: Hittest Stops Working After Loadclip?

May 30, 2007

1 main flash movie called game.swf 1 external flash movie called maze.swf

The thing is from my main movie game.swf I load the external "maze.swf" true the LoadClip procedure. This works "fine".

The maze.swf as you can guess contains a maze game, and as you all will know this works with the Hittest commando to check if the character doesn't walk up against the wall.

If I start the maze.swf as a stand-a-lone this works fine, but as soon as I load maze.swf in my main movie. The hittest doesn't work anymore, because in some way the hittest is now checking with the coordinates of the entire main movie instead of only the boundaries of the maze.

I checked If I was calling to the right path, with _root and _level0 and etc. This is al correct because I can trace all the properties from maze.swf in my main movie. But the hittest simply won't work.

View 7 Replies

ActionScript 3.0 :: Hittest Only Working With 1 Added Child

Mar 29, 2011

Ive got this piece of script where i place objects on the stage, to hittest eachother.Ive got two seperate addchilds: one child must hittest another child.[code]only one instance of the hitte_mc will hittest with the instances of Ring.

View 5 Replies

ActionScript 1/2 :: Drag And Drop HitTest Not Working?

Mar 26, 2009

I'm trying to set up a very simple drag and drop game where users drag movie clips onto other matching movie clips.If the answer is correct, the mc stays in place; otherwise, it snaps back to original position. So far, only the dragging part works -- the movie clip won't stay in place when dragged to the correct position.I'm using Flash CS3 and Actionscript 2.The Flash movie can be found here: http:[url]..As it's set up now, the mc with the buffalo symbol is draggable,and the correct drop zone is the fish with thetext.Here's the script I'm using:

// Get the movie clip's location and
// store the coordinates as variables
onClipEvent (load) {[code].....

View 3 Replies

ActionScript 2.0 :: HitTest Function Only Working On Y Axis

Oct 14, 2003

Go to [URL]. 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;
} if (Key.isDown(Key.DOWN)) {

View 1 Replies

ActionScript 2.0 :: HitTest Not Working For Plane Collision?

Apr 4, 2003

I can't seem to get hitTest to work for the plane in my little game. The code I'm using in the plane MC is:

[AS]if (_root.player.hitTest("_root.badguy"))
playerhealth -= 20;
}

[code]....

I want to the badguy plane to hit the player's plane and take a subtraction from the player's heath. I've fiddled around with using "this" instead of the full path of the playerMC - no success. My hitTest is working fine for the bullets!

View 3 Replies

ActionScript 3.0 :: Flash Simple HitTest Not Working?

Jan 15, 2012

i have attached an .fla file to show you what i am trying to achieve, i have a line (acting as a playhead) scrolling accross the screen, i am then wanting it to output to the window when it collides with each of the coloured squares, i have used similar things before but it is not working in this instance

View 5 Replies

ActionScript 3.0 :: URL Loader Not Working Properly

Jun 25, 2009

I'm trying to do in this case is populate a List UIComponent that I created with information that I get back from the PHP file. For some reason the loader.addEventListener(Event.COMPLETE, userOnLoad) isn't working and my program never gets any farther than that.

Here is my code:
import fl.controls.*;
import flash.display.Sprite;
import fl.managers.StyleManager;
DECLARATIONS
var backgroundArea:Sprite = new Sprite();
var loginArea:Sprite = new Sprite();
var userArea:Sprite = new Sprite();
[Code] .....

View 1 Replies

ActionScript 1/2 :: IsNaN Not Working Properly?

Nov 26, 2010

I've noticed that by using isNaN(number), it doesn't always return true when needed. In fact, by using:
 
var bool:Boolean = isNaN(parseFloat(numberStr));trace(bool);
 
It will return true with:

-sdfda
$%&$
asdf
 
BUT, false (when it should be true) with:
 
230asdfs
230sdfasd.50
 
It seems like the letters between the numbers aren't even considered and it returns false when it should in fact return true... If it starts with a letter, it returns true, otherwise, with a number, it's false...I need to check whether or not there are any non-numeric (except "dot") in the parameter "numberStr" (a String).

View 4 Replies

ActionScript 3.0 :: CS5 Preloader Not Working Properly

May 6, 2011

I've implemented an internal preloader in my project but it's not working properly. I use Simulate Download but the preloader only shows after something like 80% is completed, which sort of destroys the purpose of the whole thing.

import flash.events.ProgressEvent;
stop();
function preloader(progressEvt:ProgressEvent):void{
var totalBytes:Number = progressEvt.bytesTotal;
var loadedBytes:Number = progressEvt.bytesLoaded;
[Code] .....

View 6 Replies

ActionScript 3.0 :: UncaughtErrorEvent Not Working Properly

Oct 2, 2011

I don't really get UncaughtErrorEvent working for my Air 2.6 application. if i step through the code with the debugger, i get very strange results.that's the code:
 
public class Main extends Sprite{
public function Main(){
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,

[code].....

View 9 Replies

ActionScript 3.0 :: SWF Not Working Properly After Upload

Dec 29, 2011

I have a Flash gallery that works locally but not after upload.I added several photos to the xml file and only the original 8 jpgs are displayed.URL...

View 5 Replies

ActionScript 2.0 :: Preloading Not Working Properly?

Jun 30, 2009

I have a preloader in the first frame. The preloader appears only after 80 percent loading of swf.

View 0 Replies

ActionScript 3.0 :: Stop() Is Not Working Properly

Jul 6, 2009

The stop() is not working properly as if it were being ignored. I have even recreated a dummy flash document the stop() did work, however, it is still not working on the original design.

View 6 Replies

ActionScript 3.0 :: Droptarget.name Not Working Properly?

Aug 6, 2009

I'm setting up some objects connected to classes onto a movie clip dynamically, and although I'm setting the name fine, when I drag another movie clip on top of it and trace for droptarget.name I always get something like "instance01" what am I doing wrong?

View 4 Replies







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