ActionScript 3.0 :: Hittesting 1 Fat Sprite Or Many Smaller Sprites?

Jan 6, 2011

At first I had all my sprites in an array and cycled through them to detect for collisions but now I am trying to put them in 1 big sprite and testing just that. I don't know if I am doing something wrong or this is to be expected but testing for 1 big sprite creates lag within the engine. Am I correct to assume that it's because I am constantly testing the pixels of the 1 sprite? When cycling through the sprites individually i never noticed this lag.

View 0 Replies


Similar Posts:


Flex :: Controlling The Properties Of A Sprite's Child Sprites?

Dec 23, 2009

I have a sprite in which I have added other sprites. Something like:

var sp_main:Sprite = new Sprite();
var sp_group:Sprite = new Sprite();
for(i:int = 0; i < 10; i++)

[Code]....

View 1 Replies

ActionScript 3.0 :: Add A Sprite Or Object Capable Of Adding Sprites To Scene3D?

Jul 11, 2011

Ages since I last played with away3d, totally forgot how to use it.What do I do if i want to add a Sprite or object capable of adding Sprites to my Scene3D?

Edit: Using the MovieMaterial in not a possibility due to YouTube disabling Draw() on their APi

View 3 Replies

Actionscript 3 :: Setting Alpha On Parent Sprite Without Affecting Sprites Children

Mar 12, 2010

If I change some value for a parent sprite, the same value will affect all of its children. So if I set alpha or width on the parent, the child will automaticly get the same value.

View 4 Replies

ActionScript 2.0 :: Photo Gallery - Make The Image Window Smaller And The Overall Movie Smaller?

Jun 25, 2004

I found this really neat photo gallery on flashkit but there is no support or readme included. how to size this thing.. the AS code does have comments but I am not a coder.I'd like to make the image window smaller and the overall movie smaller. 325x325 or so

View 10 Replies

ActionScript 3.0 :: Printing Sprites With Scrollrects Using The Bitmap Printing Option Fixes And Prints Most Of The Stuff In The Sprite

Jun 19, 2007

I have a sprite that has a scrollbar that uses the scrollrect feature. The sprite has several bitmaps and textfields. When I print the outer sprite (The one with the scrollrect) all of the textfields outside the scrollrect are cut after the first line. In case anyone else is having problems with printing sprites with scrollrects using the bitmap printing option fixes and prints most of the stuff in the sprite. Excluding all textfields outside of the scrollrect. This however can be fixed partially by embedding your fonts.

So now the only problem left is printing multiline textfields that are outside the scrollrect. P.S. Imho the scrollrect should have nothing to do with the printed area of the sprite because the printJob.addPage has a printarea parameter.

View 3 Replies

ActionScript 3.0 :: E.target For Hittesting?

Nov 9, 2009

I have a question regarding hittest object in actionscript 3. When using events, you can check what the current target is by using e.target or e.currenttarget. I was wondering how this achievable by hittesting?since hittests are not a function.

I need to retrieve info about the hittested object.Here is an example to make it more clear:

ActionScript Code:
if(movieclip1.hitTestObject(movieclip2)){
textfield.text = "this is information selected by the hittest: " + channel[e.target.name].item;
}

I'm working on a project and using hittest to navigate. So it's pretty important haha.

View 0 Replies

ActionScript 3.0 :: HitTesting An Array?

Nov 18, 2009

I have a movieclip named Map linked to a class named Map. Inside of the movieclip I have 3 instances of a movieClip hitbox. they are named block0, block1, block2. What I'm trying to do is add them to an array using a for loop. Then in my player class I use another for loop to hitTest against the array. What I'm getting tho is this error:

Code:
TypeError: Error #1034: Type Coercion failed: cannot convert []@2393159 to flash.display.DisplayObject.
at xxx::Player/loop()[Player.as:54] The code from Player.as that the error refers to is here:

[Code]...

View 3 Replies

Hittesting Odd Shaped Objects?

Sep 8, 2009

I created a .PNG in Photoshop (see attachment) -- now when I make this into a movieclip the bounding box covers the entire area so the hittest activates as soon as my helicopter flies into the bounding box.I looked at adobe's "help" they recommended this code (by the way, I'm using Flash 8):

my_mc.hitTest(x, y, shapeFlag )
my_mc.hitTest(target)

The way I interpreted the code was like this:

onClipEvent(enterFrame){
heli.hitTest(248.1, -38, shapeFlag)
}

I read somewhere that you only use one of the two, and the shapeFlag one is the one to use.The above code I placed into the helicopter MC (named heli) - I set the x & y to where the PNG is.The PNG moves towards the helicopter, so I'm not sure if that makes a difference.I just want that if the helicopter runs into the ceiling or floor, the level resets.However my current actions activate as soon as it hits the bounding box.This is my code in the PNG:

onClipEvent(enterFrame){
this._x -= _root.levelSpeed;
}[code]....

I've tried a lot of things, and nothing seems to be working.

View 5 Replies

ActionScript 2.0 :: Hittesting Two Or More Buttons?

Aug 12, 2003

iv gotten hittest to work on me and my friends sites, but with olny one button for the MC to check for. Very simply, how do i get it to check for 2 or more?

View 6 Replies

ActionScript 2.0 :: HitTesting MC's From Library?

Sep 5, 2010

I've got a game where I need the enemys to hitTest with each other, I'm going to have copys of 3 types of enemys on the stage, instead of giving them all an instance name is it possible to hittest from the libary because I've given them instance names in the library of "enemya" "enemyb" "enemyc"

The code I have got didn't work which was -

Code:

onClipEvent(enterFrame){
if(this.hitTest(_root.enemyc)){
trace("true")
}

[Code].....

View 5 Replies

ActionScript 2.0 :: HitTesting A TextField.prototype?

Aug 23, 2009

I'm looking to run a trace that targets all TextFields on a mouse over, something like this:

PHP Code:
TextField.prototype.hitTest = MovieClip.prototype.hitTest;
onEnterFrame = function(){

[code].....

View 2 Replies

ActionScript 2.0 :: Hittesting. Special Rules?

Apr 23, 2006

are there any special rules regarding hittesting? im using this code here and its jus not working at all:

var speed:Number = 0;
var angle:Number = 0;
var angleFish:Number = 0;[code]....

im starting to get quite irritated

View 2 Replies

ActionScript 3.0 :: HitTesting Multiple Array Elements?

Nov 19, 2011

I have a tile-based platformer game under work, and I'm stuck on a problem with hitTesting:
 
//check all character collisions with levelHolder
for(var i:int = 0; i < levelHolder.numChildren; i++)
{

[Code].....

The problem here is that hitBlock only hitTests one block at a time, and when I test this: If you lean on a wall (press right arrow key) and go downwards you can go through the floor.
 
I need to make it so that I can test on multiple blocks at a time.
 
And I did try to replace hitBlock with levelHolder[i], but it gave an error saying:
 
ReferenceError: Error #1069: Property 0 not found on flash.display.Sprite and there is no default value. at Main/enterFrame()
 
I'm guessing that comes from the level array where 0 = blank block / empty space.

View 7 Replies

ActionScript 3.0 :: Hittesting MovieClip Class Array

Oct 29, 2011

I am trying to make a basic game, and have read all about bitmaps, but they have only confused me, so I am trying to succeed with a more flawed, but basic approach. I couldn't find any comprehensible tutorials on this, so I've tried it on my own, but it doesn't work.Basically I have my character in a movie clip connected to a class, and it is spawned when the movie starts, just like the "wall" class here. It populates the stage with a line of boxes, but my problem is that the hittesting only works on the first one.[code]

View 9 Replies

ActionScript 2.0 :: Shapeflag HitTesting Not Working In Movieclip?

Mar 19, 2008

I thought maybe I had to use localToGlobal, but they are on the same layer, so it can't be that. It works on the root frame, just not in the movieclip.

View 2 Replies

ActionScript 3.0 :: HitTesting Between Two Arrays Of Differing Length?

May 5, 2009

I'm just learning so I'm sure I'm making many stupid errors. How do you hitTest 2 separate arrays of different lengths, all entries against one another . Code below for guidance.

Code:
package{
import flash.display.*;
import flash.events.*;

[Code]....

View 2 Replies

ActionScript 2.0 :: Hittesting Movieclip With Movement Inside It

May 11, 2010

I'm making a game where your character must touch rings (big ovals) that are moving up and down with a motion tween (with easing). I attach these movies and push them into an array. For the hittesting, nothing is accurate. Since a movieclip inside the ring movieclip is moving up and down, the boundary box is much bigger than it should be when hittesting. If I use the x/y method, it triggers the hittest when my character is in line with the reference point. It should trigger when the middle of the character hits around the middle of the ring.

View 2 Replies

ActionScript 3.0 :: Hittesting Irregular Shaped Objects?

Dec 16, 2010

What I'm trying to do is hittest two irregularly shaped objects using their alphas and not the bounding box.

The code below hittests two objects named target 1 & target 2. This is not my code, but mine looks exactly alike, except target 1 & target 2 are replaced with my MC's. the thing is, I keep getting an error.At every function line, like the "public static function complexHitTestObject I get an error that says: Expecting right paren before left-bracket. I don't know what this error is caused by, because I can't really see why Flash wants another right paren.

[Code]...

View 6 Replies

ActionScript 3.0 :: HitTesting Against Multiple Movieclips Within An Array

Feb 4, 2012

im having a really frustrating problem. I have 6 movieclips on the stage, all acting as 'map areas', these are named area1_mc, area2_mc and so on.. I then have a car which i drive around the screen, this instance name is car_mc ... All i want to do is do a HitTest to determine if the car is on one of the 6 areas.. i have the following

[Code]...

The reason it is not working i think is it is expecting the car to be on ALL map areas in order for it to be "on map". For example if the car is in the middle of area1_mc, i get three traces. On map (refferign to it being on area1_mc) then two traces of 'off map', because it obviously isnt on area2_mc or area3_mc.

View 14 Replies

ActionScript 2.0 :: Duplicate Multiple Movie Clip And Then Hittesting Them All

May 4, 2006

i'we tried for years to duplicate multiple movie clip and then hittesting them all but i can't this is my last resort

View 2 Replies

ActionScript 2.0 :: Advance HitTesting - Test The Collision If They Are Rotated?

Oct 27, 2006

it's easy to test collision between two squares. how do I test the collision if they are rotated?

View 1 Replies

ActionScript 2.0 :: Accurate HitTesting Updating Arrays With Collisions.F8 CS3.zip?

Apr 25, 2008

I have 4 ball movie clips, a playhead and four target movieclips called mc_1-4, the array, (my_array), has 4 elements, which are each defined as having values of 0: I have a hitTest set up that will trace my_array to the output window each time it hits mc_1, to see what is happening. However the hitTest prints the array 3 times?

Am i right in thinking that this is because the hitTest is being triggered on entry of mc_1 in the center and upon exit?I need to make this hitTest be triggered once when the hitTest passes the center of mc_1. Secondly if any of the balls have been dragged and dropped on to mc_1 i want the array value with an index of 0, to change to 100 from 0 (not in terms of its index position because my array is only 4 elements long, in terms of its actual value) which i have tried to implement but i cannot configure the right code.

1. hit tests that only trigger once when they pass through the center of the object thus tracing one array.

2.use the balls 1-4 to make the array index 0, have a value of 100 if they are in contact with mc_1.

View 4 Replies

ActionScript 3.0 :: HitTesting Edges / Moving Movie Clips Stage Length?

Dec 7, 2010

This is sort of a multi-layered question- I have a movie clip that I sectioned off in quadrants:The red dot is the player, the stage is the size of one square. My goal is to, when the player moves to either of the 4 edges, the next section of the quadrant comes up (meaning if the player moves to the right edge, the section that borders the right edge will slide on screen, and the old section will slide off screen).I was wondering if there was a way to hitTest if an object is touching any part of the edges? Is the hitTestPoint method something I should look into? What I have so far is an object off screen (black rectangle), that when the player touches the quadrants slide like I want them to (at least I'm trying to make that work).Here is my code. I know some of it's wrong and/or I'm missing something.

if(leftKeyIsDown && player_mc.x > -15)
//-15 is half the size of the temporary player_mc
{

[code]......

View 18 Replies

Actionscript 3 :: Class Extending Sprite - Set The Sprite's Width And Height Properties?

Mar 5, 2010

I created a class, extended the sprite class, and now in the constructor I am trying to set the Sprite's width and height properties which are inherited from the DisplayObject. However, after I set this.width and this.height, and print the values, I get 0 for both.

What the heck is going on? When I view the livedocs I see that DisplayObject has width and height listed as public properties. I have been able to instantiate a Sprite directly, and set the width and height after it's been instantiated, so I don't get it.

package {
import flash.display.*;
public class ScrollBar extends Sprite {[code].....

View 1 Replies

Flash: `sprite.visible = False` Doesn't Hide Sprite Immediately?

Apr 4, 2011

I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:

[Code]...

View 1 Replies

IDE :: Adding A Single Sprite On Main Moviclip Sprite Remains Invisible

Mar 2, 2009

I created a new AS3 document (550px by 400px) and added the following code to the first frame.

However, when I run this, I see nothing painted on the screen at all, the screen remains completely white.[code]...

View 3 Replies

Flash :: Rotating Sprite Moves The Sprite From It's Original Location

Jul 6, 2011

I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:

package
{
import flash.display.Sprite;

[Code]....

I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.

View 3 Replies

ActionScript 3.0 :: Sprite.addChild(NumericStepper) Resizes Sprite To 100x100

May 27, 2008

[Code]...

Then the numericStepper is drawn as if it is squished to 20% its normal height. If I pre-set mySprite width and height before adding the numericstepper, the trace output is 0,0 after adding it and it is not displayed at all. Is there some way I can make the sprite only adjust to correctly fit the numericStepper OR resize it afterwards without distorting the numericStepper component?

View 2 Replies

Actionscript 3 :: Difference Between Sprite.width VS Sprite.scaleX?

Sep 23, 2011

Both of sprite.width and sprite.scaleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?

View 2 Replies







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