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


Similar Posts:


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 3.0 :: How Z Axis Works

Sep 17, 2009

I just upgraded to CS4. I'm now trying to figure out how the z axis works.I have a little project in which I have multiple different colored squares that, when rolled over scale up with tweenlite. However as it is right now, the box that is moused over does not appear "in front" of the other boxes. Is this something that can be achieved with the z axis?

View 2 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

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

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 :: Using HitTest Function With Several Objects?

Apr 16, 2007

I want to make a hitTest functions that detects if a object is hitting any of several objects. Is there a way to do this? I thought I could do this with a array and for loop. But I think that will use to much CPU when this is loaded every frame. Is there any other way?

View 1 Replies

ActionScript 3.0 :: Construct Coordinates With Distance In Meters On The X-axis And Time In Seconds On The Y-axis

Nov 27, 2011

I am trying to construct coordinates with distance in meters on the x-axis and time in seconds on the y-axis, without using the timeline. How can I draw the divisions on the x-axis and y-axis ? Or I better draw the whole thing.

var my_shape:Shape = new Shape();addChild(my_shape);
my_shape.graphics.lineStyle(3, 0xFF0000, 1);my_shape.graphics.moveTo(50,50);my_shape.graphics.lineTo(50, 300);my_shape.graphics.lineTo(500, 300);

View 9 Replies

ActionScript 2.0 :: Make An Object Move Along Y Axis Once It Has Reached Its X Axis Target?

Mar 2, 2005

I'm trying to grasp how functions and motion tweening works.

Heres my question. How do i make an object move along the y axis once it has reached its x axis target?

HEre is the code, that i got from here.

and what in this code is making the MC ease out?[code]...

View 14 Replies

ActionScript 3.0 :: Tweens Objects Return To Their Original Position - Start Jumping Between Y Axis 200 And Y Axis 83?

Aug 7, 2009

I've put together this simple code for an SWF with three roll over images (called: Training, Resources and Contact).When I roll over Training I would like the symbol Training_txt to tween its alpha to 1 (from 0) and tween its y axis to 220 (from 83).When I roll out of Training I would like to run the two tweens in reverse.
 
This works fine for each of the three roll over images, so long as each tween is allowed to fully execute before a new tween is started. The problem arises if i quickly move the mouse curser between the three roll over images before the previous tweens have finished executing.In this instance, the tweened objects start to behave erratically. They usually return to their original position as per the roll_out tween but then start jumping between y axis 200 and y axis 83 (without tweening - they just appear).

Code below -
 
stop();
import fl.transitions.Tween;
import fl.transitions.easing.*;[code]..........

View 1 Replies

Flex :: Stacked Bar Chart With Date As X-axis And Names As Y-axis?

Apr 13, 2012

I'm making a chart where the x-axis needs to have dates and y-axis names. The lenght of the bar is longer when the date is later. But I want to stack multiple bars on eachother. for example This is the code I have so far

<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[code].....

View 1 Replies

ActionScript 1/2 :: Use The HitTest Function To Check For Collisions

Apr 17, 2009

I know you use the HitTest function to check for collisions, but how would I do that the moment a movie clip is dynamically created. So the moment the clip is created it would check if it is overlapping another clip. Also, does it matter if the clips are at different depths?

View 1 Replies

ActionScript 2.0 :: Make E To HitTest F To Get Something Else Function But They Won't Work?

Sep 6, 2011

Lets say that I got movieclips A,B,C,D in my scene and E,F which only come into scene when A hitTest B and C hitTest D.I was able to make the A+B and C+D hitTest functioning properly. But when E,F came into the scene, I tried to make E to hitTest F to get something else function but they won't work.# note that there is some short animation before E & F come into scene.I am pretty sure all the instance names are named properly.

View 5 Replies

ActionScript 3.0 :: Error Accessing Function After HitTest

Oct 4, 2010

I've been using asGamer's excellent set of game design tutorials to put together a basic 'ship and enemies' shoot 'em style game - my first proper venture into using AS3 and external class files - and I've hit a problem with executing hit test results. To explain: The game uses Engine (the document class), Ship and Enemy classes. Enemies (new instances of the Enemy class) are added to the stage in the Engine class, where they are also stored in an array, enemyList. The Ship fires a Laser, and the Laser class is where we test for a hit on Enemies.

Now, in asGamer's original version he uses the hitTestObject to test for hits, and if a hit is registered, this line
PHP Code:
Engine.enemyList[i].takeHit();
Calls a function in the Enemy class to remove the relevany clip. However, as the hitTestObject includes the bounding box of a clip in its hit test, I decided to use Corey O'Neil's Collision Detection Kit for greater accuracy. The CDK CollisionList class returns an array, the each element of which is a clip with which the target object has collided.

The problem this presents is that rather than using
PHP Code:
Engine.enemyList[i].takeHit();
To deal with a collision, I now use
PHP Code:
collisions[j].object1.takeHit();
Where 'collisions[n].object1' are the movie clips hit.

When I test the game it throws an error
PHP Code:
ReferenceError: Error #1069: Property takeHit not found on com.asgamer.basics1.Laser and there is no default value.
at com.asgamer.basics1::Laser/loop()
Although the movie does not break, and continues to remove destroyed enemies as if there was no problem.

What the problem is with calling the takeHit function via the collisions array rather than the Engine.enemyList array? And perhaps suggest a way to prevent it? I should point out that the 'laser' is in fact a blast that can take out any number of enemies intersecting with the blast radius, which is why I'm using CollisionList to detect hits.

View 6 Replies

ActionScript 2.0 :: Get The HitTest() Function To Test If A Certain Symbol Is Hitting Another?

Mar 31, 2010

How do i get the hitTest() function to test if a certain symbol is hitting another symbol, but, only if drawn parts of the symbol are touching, not thier outer bounds.

View 1 Replies

ActionScript 2.0 :: [AS2] Looping Function - Using HitTest(); With Movieclips Within Arrays

Apr 28, 2007

[Code]...

NOTE: The following text is my problem and observations, if you afraid to read it all, my problem is easily guessable within the code go ahead and crack at it without my explanation :-p I'm having some trouble with using hitTest(); with movieclips within arrays. I wanted to build a function that checks the hitTest of Movieclips in arrays because the array is dynamic and it would run more efficient and faster this way.

As you may notice it doesn't check just the movieClip in the array, but a movieclip 2 scopes within it. I feel that this is my problem. I noticed in my debugger that that mc doesn't show up, but i put an onLoad event on it to trace its existence when loaded and it shows up fine. I wonder what I'm doing wrong.

View 2 Replies

ActionScript 2.0 :: Create HitTest Function That When Two Mcs From MovieC Array Hits Eachother

Mar 30, 2010

I want ask u how can i create hitTest function that when two mcs from movieC array hits eachother they can change their colour. Both of them.

View 3 Replies

ActionScript 2.0 :: Activating The HitTest - Passing The Objects Name As A Parameter Through A Global Function

Jun 16, 2004

I'm having troubles activating the HitTest, passing the objects name as a parameter through a global function. Let's say there is the following function on the main timeline:

[Code]...

View 3 Replies

ActionScript 3.0 :: Function Works Only Once?

Sep 19, 2009

I have a listener and a function for it on the main timeline, listening for TextEvents from links in a dynamic textbox nested somewhere in the movie. The problem is that everything works only once. I click on a link, it works, click again and it does nothing. I have to reload the objects for it to work again. What am I doing wrong? Do functions work only once when the main timeline is stopped?

View 1 Replies

ActionScript 3.0 :: Function Works Only On The Second Click

Dec 14, 2010

I created what I though was a pretty simple function for a mouse event listener. The funtion goes to a frame in the current movie clip as well as the parent movie clip. For some reason however the first time you click the button, it only effects the parent movie clip. When you click on it the second time, both movie clips are effected. Here is the script,

[Code]....

View 2 Replies

ActionScript 3.0 :: Function Works On Some Objects But Not Others?

Jun 10, 2011

And I don't know how to use the debugger in Actionscript. This is my code. It's in a class called GeoPiece and is being activated when a movieclip of instance GeoPiece is dragged over a movieclip of instance GeoPuzzle. lastObjOver is a place holder and is an instance of GeoPuzzle.

I want the mc from GeoPuzzle to highlight (goto frame "Over") when it is touched over and unhighlight (goto frame lock or out) when untouched. The script works perfectly - unless the GeoPuzzle piece was already locked. For some reason, it then sets itself to null and I can't figure out why.

ETA: The touchevent its responding to is a TOUCH_MOVE attached to the GeoPiece.

[Code]...

View 8 Replies

ActionScript 3.0 :: Works Just In Constructor Function?

Jan 7, 2010

If I pass variable(s) like this in document class action script file(I'm not even sure if I can pass more than one variable):

Code:
ballPointRight = new BallPointRight(ball, xDir, padScreen) ;

And now the BallPointRight's action script file:

Code:
package {
import flash.display.MovieClip;[code]....

doesnt work since it doesnt recognize variables...

View 4 Replies

ActionScript 2.0 :: Function Works, But Not When Called By Interval?

Dec 14, 2009

I have a function ("advance_slideshow()") that ticks a slide show up by one, then it loops back at the end. It works when called from the key listener I set up for debugging. However it does not work when called from setInterval. I added a trace to the function to confirm that it was being called, which it is; it just doesn't work when called via the interval

Code:
//////////////////////////
/* IMPORTS AND INCLUDES */

[code].....

View 1 Replies

ActionScript 2.0 :: For Loop Works In Trace But Not In Function

Mar 9, 2010

I have 20 players in a game and cutting and pasting lots of code except for a few numbers. I have future features that would require over 400 lines of mostly repeated code. So I learned how to use "for", and practiced with a trace command. Traced the results exactly as I thought. However when I apply it to the guts of my function, the movie breaks down. I suspect it's because the function is being called on an EnterFrame command and the for loop I wrote is being executed over and over.

This works when I hand code:
Actionscript Code:
function drill(){GUESS0 = ((guess0min * 60)*1000) + ((guess0seconds * 1000))
GUESS1 = ((guess1min * 60)*1000) + ((guess1seconds * 1000))
GUESS2 = ((guess2min * 60)*1000) + ((guess2seconds * 1000))
GUESS3 = ((guess3min * 60)*1000) + ((guess3seconds * 1000))
GUESS20 = ((guess20min * 60)*1000) + ((guess20seconds * 1000))
//and then 300 more lines of other code}

And then a button later calls this when pressing:
Actionscript Code:
my_MC.onEnterFrame = function(){_root.drill ();
//so _root.drill is continually being called, which is good, because it has all sorts of data that needs to be refreshed, but I think it's screwing with my "for" loop.}

And the following is NOT working.
Actionscript Code:
function drill(){for (i=0;i<20;i++){
"GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));";}

But when I trace it in a separate test movie, it outputs exactly what I would hope it placed in the code:
Actionscript Code:
for (i=0;i<5;i++){trace("GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));");}

So at the end of the day, I guess I can trace these results in a test movie and use it to generate what I need, and cut and paste it into the project... but I thought 'for' loops were for saving time AND space. Am I using this code right? Maybe my use of "", or +, or i is misguided?

View 4 Replies

ActionScript 3.0 :: Function Only Works In Simple App But Not In Complex One

Mar 11, 2010

I made a simple app with 2 movieclip symbols containing photos of a butterfly with this actionscript:

import fl.transitions.Tween;
import fl.transitions.easing.*;
butterfly_mc.addEventListener(MouseEvent.CLICK, bigPic);
butterflyHand_mc.addEventListener(MouseEvent.CLICK, bigPic);
function bigPic(e:MouseEvent):void{ new Tween(e.currentTarget,"scaleX",Strong.easeOut, e.currentTarget.scaleX, (e.currentTarget.scaleX * 1.4), 4, false);
[Code] .....

I don't get any error messages but when I click on case1_mc.c1_mc.case1a_mc or case1_mc.c1_mc.case1b_mc nothing happens.

View 11 Replies

ActionScript 3.0 :: AddEventListener In A Function No Longer Works

Apr 23, 2011

Should that be avoided due to local scope factor? function resizeDisplay() below no longer works

[Code]...

View 4 Replies







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