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


Similar Posts:


Actionscript 3 :: Conditional Statement Not Working?

Jan 23, 2010

In my code here:

var manTimer:Timer = new Timer(1700,5);
manTimer.addEventListener(TimerEvent.TIMER, moveMan);
function moveMan(e:TimerEvent):void {[code].....

I am trying to get it so that when btnElScorcho or btnTheGoodLife is clicked it'll move my "man" mc out onto the stage. It starts at 590px and ends at -10px. That part is working.What is not working is my conditional statement that tells it to only move the "man" if he is at the x position of 590 or greater, because, when one of the 2 buttons is clicked again, I don't want to move him out if he is already there or if he is already moving out.So for some reason, "man" will still move when the buttons are clicked a second time and oddly enough, "man" will only move twice as opposed to the normal 5 times set in the function.Maybe I can change the if statement to check if the button has already been clicked as opposed to where "man" is?

View 1 Replies

ActionScript 2.0 :: Conditional Statement Not Working?

Jul 31, 2008

In the code below i can't seem to get the second conditional statement to work.

on (press) {
startDrag(this, true);
}
on (release) {

[Code].....

View 3 Replies

ActionScript 1/2 :: Conditional Statement Not Working Properly On Button?

Nov 25, 2009

Here is my current small piece of code I have on a given "letter" button..

on (release) {  if (_root.Acheckmark._visible=true) {  _root.AScore = _root.AScore+_root.APoints;  } else if (_root.Bcheckmark._visible-true) {  _root.BScore = _root.BScore+_root.BPoints;  }}

View 1 Replies

ActionScript 2.0 :: Removing OnEnterFrame Conditional Not Working Will SetInterval?

Feb 25, 2009

I am working on someones as2 file and I noticed that they had an onEnterFrame running non stop in the movie. I don't use onEnterFrame personally. So I tried to create a conditional to stop it. While the conditional worked its stopped the fluid animation they had used. So I need to figure out some other way to get rid of the onEnterFrame. Anyone have any ideas here? The AS basically resizes a box on stage when certain movies are loaded.[code]

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.

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

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 2.0 :: Movieclip As Button HitTest Working Intermittent?

Jul 9, 2004

I was playing around last night trying to learn simple AS to make a movie clip act like a button. I wanted the button movie clip to reduce the alpha value of the other movie clip when you rollover the button and when you roll off the button the alpha of the movie clip goes back up. It works, but if you keep rolling over and out of the button movieclip sometimes the alpha gets stuck at a certain value for a bit, then does what its supposed to. I'm using onEnterFrame () to do the hitTest constantly.

Here's the SWF and FLA files for you to look through:

hitTest SWF
hitTest FLA

Here's the AS code I used in the frame to do this:

Code:
onEnterFrame = function() {
if ( background._alpha > 100 ) {
background._alpha = 100;

[code]....

View 12 Replies

ActionScript 2.0 :: Hittest On Duplicated Movie Clips Isn't Working

Apr 21, 2004

i am currently making a game, and for some reason the hittest on my duplicated movie clips isnt working i know how to do them , and know it should be working , because it works on one of the movie clips but none of the others so im guessing it something to do with depth? i will give the code if any1 replys

View 2 Replies

ActionScript 2.0 :: HitTest / LocalToGlobal Not Working - Traces Out To The Correct Location

Feb 12, 2010

So I am able to trace the correct coordinates. However the hitTest fails. Here is my code:

[code]....

View 1 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 3.0 :: Do Something After Hittest " Remove Hittest After First Collsion"?

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

IDE :: How To Conditional Statment

Oct 26, 2009

So I'm not that familiar with using conditional statements yet, and I'm trying to get my head around it. I know what I need it to do, I'm just not sure of the correct syntax.I basically want a statement that says:

if( movieClip1 == frame 10)
{
then play movieClip2

[code].....

View 8 Replies

Stopping A Flv Using A Conditional Statement?

May 26, 2009

I have FLV files that continue playing when I leave the frame that they are on. I can stop the playing FLV by putting this code on the following frame:
 
if (demo.playing) {  demo.stop();}
 
Where .demo is the name of the instance of the .flv component.
 
Here is the problem - I have many frames with many flvs, and when I tell flash to stop multiple FLVs, for instance:

if (demo.playing) {  demo.stop();}
if (demo2.playing) {  demo2.stop();}

I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference
 
As far as I know, flash is telling me that since the instance of "demo2" has not started playing yet (ex. the user only went to the page with the "demo" flv, but not the "demo2" flv yet) that flash has no idea what demo2 is yet. I thought using a conditional statement would remedy this, but I suppose the .swf can't stop playing something it does not yet know exists.

Is there any way I can introduce all of the flv's at the beginning of the file, yet not have them play and not have flash "forget" about them so that I can stop them using the code above? Or is there a way to have the conditional statement not error in the event that the referenced instance has not yet been "introduced"?

I really wish they would have added an "exit frame" command in AS 3.0...

View 1 Replies

ActionScript 3.0 :: Conditional In A Function?

Oct 18, 2009

I'm trying to make a gallery loaded from external files, and I try to not use ready packages or swfs, so I wrote a code. I have many images in a folder and a xmlListfile of this images, and I accomplished to load them one by one, but when the list reach to end in both ways (start or end), Button function for the next images continue to work, I treid to solve to problem with a conditional in function but it didn't help.

The code is:

ActionScript Code:
var i:uint = 0
var imageLoader:Loader;
var xml:XML;

[code]....

View 4 Replies

ActionScript 3.0 :: Using Variable In More Than One Conditional

Apr 14, 2012

It's a little more complex than that, actually. Inside a function, which is called by a Timer Event, I have many conditional statements based on CurrentCount of my Timer. Nested within these conditionals are more conditionals.
<<<I know it's amateur programming, and I'm sure there are much more elegant ways, but I'm just learning (via attempting a difficult challenge).>>>
One way I'm trying to control all these conditionals is via a random number, from 1 to 3. My problem is that after generating the number within one "if (currentCount == )" statement, the variable is no longer available to be used by the next "if (currentCount ==)" statement. Is this some terrible side effect of using the Timer class??

Code:
var timerMain:Timer = new Timer(900, 25)
timerMain.addEventListener(TimerEvent.TIMER, takeTurn);
timerMain.start();
function takeTurn(e:TimerEvent):int {
if (timerMain.currentCount == 4) {
[Code] .....

View 6 Replies

ActionScript 3.0 :: Create A Conditional Button?

Feb 15, 2009

I want one button to do two things.

1) play a movie clip from frame 1-40

2) and then... play it from frame 40 until the end [code]...

View 1 Replies

ActionScript 3.0 :: Movieclip In Conditional Statement Of If?

Nov 28, 2009

In the code below how can I use the movieclip in the conditional statement? This is simplified, there is lots more going on but the basic issue is shown. I want to say if currently dragged mc is dot1_mc do the copyDragTo35 function

PHP Code: var item:MovieClip;
//add event listeners to all dots
kite_mc.dot1_mc.addEventListener(MouseEvent.MOUSE_DOWN, onItemDragStart);
kite_mc.dot2_mc.addEventListener(MouseEvent.MOUSE_DOWN, onItemDragStart);
function onItemDragStart( e:MouseEvent ):void {

[Code]...

View 2 Replies







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