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


Similar Posts:


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

ActionScript 2.0 :: Playing Frames Inside A MC Inside A MC That Is Inside A MC?

Mar 19, 2007

much like the title says. how do i put code in the main timelinesuch as gotoAndPlay(x)x refering to a a frame inside a MC inside a MC.

View 5 Replies

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

ActionScript 2.0 :: Adding Properties And Events To MovieClips Inside A Loop Inside A Function

Dec 8, 2009

I have done this same thing in ActionScript 3, but am not familiar with ActionScript 2, which I am forced to use for this project. I am loading products into a SWF via XML and attempting to add a click event to each dynamically-created movieclip. Simply tracing the text from a node in XML will do for now. I'd like to assign a property called "desc" or "description" to each movieclip and have it trace that property's value when clicked. Here is the relevant portion of my code as it stands:

ActionScript Code:
var iXML:XML = new XML();
iXML.ignoreWhite = true;

[Code].....

View 6 Replies

Flex :: Preview A PDF Inside AIR Application Inside Transparent And Custom Window?

Sep 20, 2011

I have a transparent windows (skinnable). Inside, I'd like to preview some pdf file. BUT, in the only a black screen appear

View 3 Replies

AS3 :: Image - Add A Child Inside A Newly Created Instance, Inside Of A Loop?

Feb 2, 2005

I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.

var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();

[code]....

View 2 Replies

AS3 :: Add A Child Inside A Newly Created Instance, Inside Of A Loop?

Jun 6, 2010

I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.

var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();

[Code]....

It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.

View 2 Replies

ActionScript 3.0 :: Stop Inside Frame Not Working When Loaded Inside SWf

Mar 1, 2011

I have a flash code where i am loading an AS 2 SWF inside AS 3. The thing is if i put the AS 2 SWF on same domain its working fine but if i put AS 2 SWF on different domain it loads the SWF properly but the "stop()" written inside the AS 2 frame doesnt work... and it keeps on playing all the frames continuously...

[Code]...

View 9 Replies

ActionScript 3.0 :: "stop" Inside Frame Doesn't Work When Loaded Inside Swf?

Mar 1, 2011

I have a flash code where i am loading an AS 2 SWF inside AS 3. The thing is if i put the AS 2 SWF on same domain its working fine but if i put AS 2 SWF on different domain it loads the SWF properly but the "stop()" written inside the AS 2 frame doesnt work... and it keeps on playing all the frames continuously...
 
Here is the loading code..

var context:LoaderContext = new LoaderContext(); 
if(Security.sandboxType == Security.REMOTE){ context.securityDomain = SecurityDomain.currentDomain };
var objLoader:Loader = new Loader();var mRequest:URLRequest = new URLRequest("SomeURL.swf");objLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, onSWFLoadComplete);objLoader.load(mRequest, context);

[Code]...

View 1 Replies

ActionScript 3.0 :: Flash Button Inside MovieClip Inside MovieClip Doesn't Dispatch Event

Jan 25, 2012

I have a Button that is inside MovieClip1 which is inside MovieClip2; yet when i click the Button it doesn't dispatch Event.

View 5 Replies

ActionScript 1/2 :: Link A Button Inside A MC On Frame1 To A Frame Inside Another MC That Is Located On Another Frame?

Apr 25, 2011

is there any way I can link a button inside a MC on frame1 to a frame inside another MC that is located on another frame.Ive got 2 frames in total. On the first frame Ive got an Mc and inside this one Ive got a button that needs to be linked to frame number 50 which is inside a MC located on frame number 2.

View 1 Replies

ActionScript 2.0 :: Button Inside Button Inside Movieclip?

May 14, 2005

I have a button inside another button which is inside a movieclip. *whew*I have it so that when you click on the movieclip, a dialog box pops up. I have two buttons on the dialog box, but for some reason you can't click on them and when you do, the dialog box just disappears. Here's a picture of what I'm talking about, so how do i get the "YES/NO" buttons to work? Oh, the buttons are not included in that Graphic

View 6 Replies

ActionScript 3.0 :: Accessing A Child Inside A Child Inside A Child?

Nov 23, 2011

mHook -> mBottom -> hItemButton -> itemButton[a] -> itemButtonExp[a]

so i press another butoon, and retrieve a number 2, how do i access itemButton[2].itemButtonExp[2]? Coz i need to change the text field in there?

in AS2 i can access it directly by changing itemButtonExp[a].text, but how do i do it in AS3?

View 3 Replies

ActionScript 1/2 :: Targeting A Movie Clip Inside A Movie Clip Inside Another Movie Clip With A Twist?

May 9, 2010

Im able to link to a movieclip inside a movieclipUnfortunately one of the movieclips now are a scrollbar and scroll. Now the actionscript isnt working?cal.onPress = function() {gotoAndPlay(2);message1.contentMain.message.total = unit1;

View 17 Replies

Play .MOV Inside .SWF?

Jul 23, 2009

One of my .SWFs is 95Mb, I have the animation in .MOV form and have been trying to play it inside the .SWF, but it would not play on Newgrounds, for example. I know you might have to make the .MOV play from a server to play on the web, but Im not sure how to go about doing that. Ive just never had to put my animation in .MOV form then back into a separate .SWF due to being such a large .SWF to begin with.

View 21 Replies

Swf Inside Fla Stage?

Aug 27, 2009

how to do this and there are several answers but none worked for me.  I have a swf which I wish to insert inside the flash stage.  This swf is the airtight postcard viewer.  The stage is basically a picture of a table top table with the left side having some objects.  I want to be able to tween the postcard viewer onto the right side of the table so the pictures scatter out on the right 2/3 and not interfere with the objects or "fall off " the table...once the viewer is done looking at the gallery and click on another link, then all the pics move/tween out (onRelease) as a group out of the way and new contents tween in.  I've tried creating a new object, movie clip, while inside this instance I import onto stage the swf file and back out to scene 1 and place this object onto the stage but it doesnt work.  I can see the swf on the stage but it wont play! I get ghis error which said "statement must appear within on/onClip Event handler..."

View 1 Replies







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