ActionScript 2.0 :: Advanced HitTests With Any Of The "mc1" , "mc2" Etc?

Jun 9, 2008

I currently have a file that pulls out instances of a movieclip from the library and has them move across the screen. It names them "mc1" , "mc2" , etc, and the number is controlled by a variable. I also an on click event which attaches a movieclip to the stage in the same manner. this clip then moves down the stage. Each time the user clicks, it checks that there are less than the max of that movieclip, and if so it then sends down another instance. I want these movieclips to be able to hitTest with any of the "mc1" , "mc2" etc, but i can't seem to get it right. Also, i want it to reset the variable, b, which is used to name the movie clip the moves down the stage.
This is how i attach the bomb movieclip.

Code:
if (b<=bombs) {
attachMovie("bomb", "bomb"+b, (i+b));
bomb = _root["bomb"+b];
b += 1;

Now, how can I make each bomb able to hitTest with any of the "mc1", "mc2" etc that it may encounter, and what is a good way to reset b so that i keep the instance names "bomb1" , "bomb2" etc. I thought of just using a hitTest for each bomb instance, but I wanted to be able to add bombs at a later point if i wanted by simply changing the bombs variable.

View 4 Replies


Similar Posts:


Html :: Rendering HTML Text Containing Advanced HTML Tags Like <strong> - <em> - <span> And Advanced HTML Entities In Flex

Aug 4, 2011

I am designing a web application in Flex 4 and currently facing an issue rendering advanced HTML tags and entities in Flex 4. All I want to do is basically render an HTML text coming to me something like the one given below:-

[Code]....

View 3 Replies

ActionScript 1/2 :: Hittests For Mcs Inside Other Mcs?

Aug 5, 2010

I have a hittest code that's supposed to prevent an mc from moving into a space occupied by another mc. The thing is, the first mc is inside another mc and for some reason the hittest isn't registering. The code I'm using is below. Is it wrong somehow, or is there another code I should be using?
 
Key.addListener(keyListener);
this.onEnterFrame=loopF;
function loopF() {

[code]...

View 3 Replies

ActionScript 2.0 :: Having Multiple HitTests With Same Movieclip?

Apr 29, 2010

I'm currently programming in AS 2.0, and I'm trying to get a piece of code to work. I have a movieclip that is deployed when the user clicks a mouse button, sort of like a bombshell being dropped on an area.

However, when I run it, it's quite obviously only registering one of the hitTests, because _parent.sprite_counter only decrements by one, regardless of how many enemies are destroyed. That's the other weird thing; no matter what, even if the counter never decrements, the movieclip still is removed.

Is it because you've got several movieclips simultaneously trying to decrement the same variable?

View 2 Replies

ActionScript 1/2 :: HitTests Dont Work ?

Aug 7, 2011

Ive got this script. when u press a button u can create a movie clip called man. when u press another button u can create one called enemy. thay both create at different sides of the seane and thay walk past each other.but when thay touch each other thay should go to frames inside them. ect Attack,Die.

var mans = 0;
function addman() {
if (Gold>=10) { [code]....

View 4 Replies

ActionScript 2.0 :: Looping Through Multiple Hittests

Dec 5, 2009

I have many, potentially hundreds, of objects that are floating around the screen. These objects are named "Object1", "Object2", "Object3" and so on. Another object is moving around the screen and if it hits any of the other objects, it destroys them. The thing is, if I have a loop like:

Code:
for(var i = 0; i < ObjectCount; i++)

where ObjectCount is subtracted off each time an Object is destroyed. Now say Object1 is removed, then the loop will fall short and not check for a collision for the Object with the highest number. The way I am dealing with this at the moment is I am looping through the initial number of objects and not subtracting off ObjectCount, so when there is only say 10 of an inital 100 objects left, it is still looping through all 100.

Here is what the principle of it is:

Code:
for(var i = 0; i < ObjectCount; i++)
{
CurrentObject = GameArea["Object"+i];

[Code]......

And as you can see, if Object1 is removed, then the Object with the highest number on it will not be checked.

View 3 Replies

ActionScript 2.0 :: Mx2004 Multiple HitTests

Sep 14, 2004

I have 9 static movieclips arranged in a 3 by 3 grid, and 1 movieclip that moves using keypresses (invisible_mc)[code]when a hitTest is registered between the invisible_mc and any of the icon_mc's, The icon_mc goes to and stops on frame 2..else it goes to and stops on frame 1. I have constructed the hitTest as follows.is there anyway to reduce the endless repetition of code? [coe]

View 1 Replies

ActionScript 2.0 :: HitTests On Multiple Objects?

Apr 9, 2005

I have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool.[URL]there's only one wasp present at a time and it works)Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work.So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?

View 5 Replies

ActionScript 3.0 :: How To Handle Multiple Hittests

May 24, 2009

I've been reading up and looking at examples of how to handle multiple hittests. So far in my example I have failed.

[Code].....

Basically I want to be able to check for a hitTest against all the bullets on stage against all atoms created. I attempted to do this with two for loops and it didn't work

View 4 Replies

ActionScript 2.0 :: HitTests On Multiple Objects

Apr 9, 2005

For instance, I have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool. ( see [URL] , there's only one wasp present at a time and it works) Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work. So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?

View 5 Replies

Professional :: Create Multiple Enemies And Be Able To Do HitTests Against Them?

Oct 12, 2010

i got this flash with duplicated mc's say...enemy1, enemy2, enemy3. now we all know we can do something such as..
 
if {_root.blah.hitTests(_root.enemy)){_root.enemy.nextFrame();}}
 
because the enemy is duplicated and its no longer "enemy" but enemy12 or ****.is there any way to ...create multiple enemies and be able to do hitTests against them somehow.Also im not really a fan of attachMC

View 5 Replies

ActionScript 2.0 :: Curved HitTests For Flash 2004 MX?

Aug 16, 2006

how do you make a curved/slanted hitTest?

View 1 Replies

ActionScript 2.0 :: Movie Clip Hittests Anything On The Screen?

Jun 15, 2007

Is it possible to check if a movie clip hittests anything on the screen?

View 1 Replies

ActionScript 2.0 :: [flash Cs4] Arrays And Hittests Not Working?

Sep 2, 2010

My fish is swimming along and needs to catch the food and avoid the poison. I've attempted to create arrays for the food and the poison so they are randomly dropping down. I've also added a hittest but can't get it to work.

I'm not really happy with the randomisation of the array, there are too many instances appearing on screen and I'm not sure how to fix this. Is there an easier way to animate the food dropping down without using as2 and arrays? There is also something wrong with my score, each food should be +10 to score and poison should be -10, but that doesn't seem to be working either. I also don't know what script to type to end the game to either a congratualtions screen or game over screen. Basically I have no idea what I'm doing and haven't had much help from my teacher, he may as well be speaking another language.

View 2 Replies

ActionScript 2.0 :: Duplicating Movie Clips, Loops And HitTests?

Mar 18, 2010

I'm creating a simple game called shape wars. The game is shooting game where a blue cube(the player) fires blue shapes at the enemy(the red cube). The red cube also fires red shapes at the blue cube.Here is my code for duplicating the red shapes (this code is contained within the enemy)

onClipEvent (enterFrame) {
//attack
att = random(6);
if (att == 1 && dead == false) {
_root.redBullets++;

[code]....

View 2 Replies

ActionScript 1/2 :: If Multiple Hittests Equal True, Go To And Play Next Frame?

Dec 7, 2009

I am trying to finish up a project and run into this problem, right now I am trying to create a drag and drop game and on the last game you can dropparts into the others, what I want to happen is that when all are in the correct spot gotoandplay next frame. This is my current code,

if(one_mc._droptarget=="/onedef_mc" && two_mc._droptarget=="/twodef_mc" && three_mc._droptarget=="/threedef_mc" && four_mc._droptarget=="/fourdef_mc" && five_mc._droptarget=="/fivedef_mc" && six_mc._droptarget=="/sixdef_mc" &&

[code]....

View 9 Replies

IDE :: Movieclip HitTests On Particular Layers Of A Movieclip?

Mar 19, 2010

I'm working on a game project for school and I'd like to cut down the amount of library items I'm going to have to make for each level (I have a clip for unwalkable areas, places where shots can impact and so on.) Is there a way I can just draw one movieclip per level and cut up its parts into different layers, then call hittests on just specific layers instead of the whole movieclip?

View 3 Replies

Flex :: Use Advanced Datagrid In It?

Feb 22, 2011

How to use the advanced datagrid in Flex?

I am trying to get the values from a database and construct the hierarchial data. In particular, constructing the dynamic hierarchal data for advanced datagrid.

View 2 Replies

ActionScript 2.0 :: FMX Advanced Buttons (mcs)

Jul 29, 2003

I'd like to know if there is a way to do the following: have a movieclip to act as a button, that is:

have an "over" and "out" states but at the same time have another frame that is used to have an "active" state when clicked. The problem is the following: since there is a rollOut state defined, when clicked the mc jumps to the active state (frame) but returns to the out state when cursor moved out of it of course...so...how do you have a button with, over, out and active states?

View 5 Replies

IDE :: Advanced Masking With Flash?

Jan 14, 2009

Lets say I have 3 layers A, B and C. I want A to be the mask for B which is pretty easy, but at the same time I want B to be the mask for C. Is that possible?

View 2 Replies

ActionScript 3.0 :: Advanced Use Of Document Class?

Aug 24, 2010

when I first start working with flash CS4, I saw a parameter on the properties that's called Document Class. I did some research on the net and found mostly tutorials on how to add a Document Class to a project, with a few comments on that the Document Class is: it acts like a "main()" block of a program, means the code is performed once the project is playing.

On one of the pages I saw a sentence that made my jaw drop... they said that using the Document Class you can avoid writing code on the time line and actually centering all the code on of the project at the Document Class. how can this be?? can you control of the code at any frame, how?, the Document Class is a class not a block of flow of code.

View 3 Replies

ActionScript 3.0 :: How To Make Advanced Colorpicker

Jul 28, 2009

how to make advanced colorpicker in asctionscript 3.0

View 2 Replies

ActionScript 3.0 :: Get Into More Advanced Flash Design?

Nov 18, 2009

I am looking to learn Actionscript 3 but have not been able to find the best way to do this. I have knowledge with HTML and CSS and have used Flash to create simple web banners, etc., but I want to get into more advanced Flash design and use Actionscript. I have looked through books but they all seem to require some knowledge of programming already. What is the best way for someone who has no programming experience to begin to learn Actionscript? Is there a specific book someone can recommend, or training course or a person who does 1-on-1 training?

View 7 Replies

ActionScript 3.0 :: Advanced Webcam Filter?

Jan 24, 2011

Is there any way of using bitmapdata or any other method to take a persons webcam and output it with a filter that for example looks like the graphic pen filter in photoshop? Or should I just stop this thought and crawl back in the cave?

View 2 Replies

Flex :: Advanced DataGrid CheckBox?

Jan 12, 2010

I have a scenario like, Advanced DataGrid have a checkBox and if i select the header checkBox all the field checkBoxes has to be selected that means multi-select checkBox.

View 1 Replies

Flex :: Sorting In Advanced Datagrid?

Jan 18, 2010

I have a Advanced Datagrid with sorting. I think it is string sorting by default. But i need the sorting in number. How can i achieve the number sorting.for example: i have row numbers like 1 to 100 . i need number sorting like 1,10,100.

View 2 Replies

Flex :: Create The Advanced Datagrid?

Feb 2, 2010

I have a Advanced DataGrid requirement. But i do not have idea how to create it.

View 2 Replies

Actionscript 3.0 :: Advanced After Effects And Flash

Aug 28, 2008

im getting this error when i export the file:[Tweener] Error: The property 'frame' doesn't seem to be a normal object property of [object ticket_1] or a registered special property.same error to the original download from the site?i did download "caurina" to my AS folder.

View 6 Replies

ActionScript 2.0 :: Add A Advanced Preloader To Splash.swf

Jul 26, 2004

I have two HTML pages, each with a .swf movie on them. The first page has the splash .swf intro movie on it. I want to add a preloader to splash.swf that loads main.swf which is on main.html which loads when you click ENTER. I don't know if this is possible or not. The reason I have 2 seperate .swf's on seperate pages is because I need a different background color for each page. If this can't be done then I would be interested in just loading the main.swf into the user's cache as soon as they open the first page so that it acts as a preloader. I uploaded it to [URL]. The .swf's might not load correctly on mac's for some reason, but should be fine on a PC (no clue why).

View 1 Replies

ActionScript 2.0 :: Doing The Advanced Colour Tweening?

May 9, 2006

Im currently building a site for a FIJI Sailing Tour....[URL]As you can see in the above URL, I have 2 photos colour tweening in the timeline from one to the other, in a loop, easy, but. How do I create that exact same effect with Actionscript? Without animating the photos in the timeline?

My second question is:I was hoping to loop maybe 5-10 different photos using the above transition, ..but the file size is too large already when I'm only using 2 photos!!� How can I tell the swf to only preload one image at a time? So that all the photos dont have to load before it begins the loop?

- quickly preload the 1st photo then colour fade in,

- stall for 10 seconds,

- then start preloading the next photo,

- then colour fade out, and so on.....

View 5 Replies







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