ActionScript 2.0 :: Trigger Clips From Array Using HitTest?

Jun 24, 2007

I've built an array of movieclips - all of them sitting static on the stage. I'm trying to trigger the clips to play as they are hit by an invisible/alpha 0 bar which sweeps across the stage... kind of like a mexican wave? I'm still a bit crappy with arrays - here's my code:

[Code]....

View 3 Replies


Similar Posts:


ActionScript 2.0 :: HitTest To Trigger Sound?

Nov 27, 2005

I'm a flash newbie working on a "game" for an architecture grad school class, using 2004 MX and and a Flash 8 demo. The game is a player in a street scene, where the user moves the player around with the arrow keys, and the up and down keys also zoom in and out. That part is working okay. My other objective is that when the player collides with any of the bulding facades, text describing the building would pop up, and a sound would be played. This is where I'm having trouble. I'm having some success with using hitTest to keep the player contained within the buildings, but great difficulting trying to get sound to play or text to appear when the player collides with a building front.

I converted one of the building facades on the "obstacles" layer to a movie clip ("snare3_mc"), with export to actionscipt checked. I'm trying to reference this movie clip in the "actions:Frame 1" code to play a sound when the player collides with it, and I'm also doing a test to see if it works by having it trace some text. I can get the trace to work for the "obstacles" layer with the buildings, but not specifically for the "obstacles.snare3_mc" facade (the green one). If I change line 123 of the code from "obstacles.snare3_mc" to just "obstacles", the trace text works, but I hope to have it specifically address the green building, not all of the buildings. Somehow I must not be properly loading or properly referencing the green object, my "snare3_mc" movie clip. Any ideas?.

Beyond not being able to specifically address the "snare3_mc" in the code to get the hitTest to even work, I can't get my audio clip to play no matter what I try. I'm trying to make the player's collision with this movie clip trigger the "snare3.wav" sound, but to no avail. The part of the code where I'm attempting this is the same hitTest with the trace text, lines 123-128 of the "actions:Frame1" code. Again, I'm probabl-y improperly loading or improperly addressing the sound in code.

The one other thing I want to do is to try and make text pop-up in a hidden box when the player collides with the green facade ("snare3_mc"). Ideally this text would appear out of nowhere when the player is in collision with the green facade, but dissapear entirely when the player moves away from the facade. I haven't even tried this yet in my .fla, but would want it as part of the same hitTest referred to above, lines 123-128.

Attached are 2004 MX and Flash 8 .fla files of this rough, ugly test version of my game.as the semester is winding down and my professor is not so into Flash or games. I feel like I am close, but really need help with these three little issues: properly referencing movie clips in the code for the hitTest, making the hitTest play a sound in my library, and making the hitTest pop up a text box with text while the player is colliding with the building facade.

View 1 Replies

ActionScript 2.0 :: HitTest Trigger Event AFTER Wheel Has Finished Spinning?

Feb 12, 2011

I have a wheel that the user can spin by flicking it with a mouse (think wheel of fortune). It needs to trigger an event once the spinning has finished depending on what section of the wheel it has landed on. I can get it to trigger an event but it triggers every time the wheel passes the hitTest object, not just when it is done. I've attached a sample of it. All help is appreciated, as I am really pulling my hair out on this one.

View 11 Replies

ActionScript 2.0 :: HitTest With Multiple Clips?

Feb 2, 2004

say I have 3 movie clips I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work

[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three;
}
onClipEvent (enterFrame) {

[Code]...

It's just a quick example of what im trying to do. one, two, and three are movieclips. Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?

View 5 Replies

ActionScript 2.0 :: [MX] HitTest With Multiple Clips?

Feb 2, 2004

I have 3 movie clips... I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work

[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three; [CODE]....

one, two, and three are movieclips.Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?

View 5 Replies

ActionScript 2.0 :: Hittest With Multiple Array - Without The Rest Of The Array Numbers Being Reset

Mar 20, 2009

The Setup: For each movieclip the hittests a set of "target" movieclips an array is given a value. If mcIcon1 is dropped onto mcTarget1 the first number in the vacant array is given the value of one. The Issue: If I remove mcIcon1, for example, from the mcTarget1 movieclip I can't find a way of just removing the 1 from that array without the rest of the array numbers being reset.

[Code]...

View 9 Replies

ActionScript 2.0 :: HitTest With Scripted Movie Clips?

Aug 9, 2010

Ive created a project that creates random movies clips with text in them, everything works fine except that movie clips will overlap each other due to the random nature of the project.I've looked everywhere tips on hitTest methods but I cant seem to get it right, the major problem is that the clips have similiar names, if I try a hit test the movie clip will just detect itself and not look for the other clips.

View 3 Replies

ActionScript 2.0 :: Hittest On Duplicated Movie Clips?

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?

View 2 Replies

ActionScript 2.0 :: HitTest Through A Group Of Movie Clips?

Nov 20, 2005

I have this "point" movie clip that starts on a random hitpoint. I can drag around, on the stage and there are more than 10 small invisible movie clip.How do i create any sort of algorithm where it can somehow "loop" thru all the movie clips to test if it hits any?If so, it will snap to it, else it will revert back to the previous hit point?

View 2 Replies

ActionScript 2.0 :: Make A Hittest Between Two Duplicated Movie Clips?

Mar 21, 2007

I am making a small game in which you are a little shooty spaceship type thing, and there are duplicated mines falling around you. When you press space, the shooty spaceship type thing fires duplicated bullets. How do I check a hittest between any bullet

View 3 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 And Changing Scales And X-y Positions Of Parent Clips?

Sep 29, 2005

I'm just wondering if hitTest can be affected by the changing x,y coordinates or the changing scale of the parent clips. My platform engine doesn't seem to work everytime I try to add a script to a parenting clip (of a playable character and a computer character) that changes the x and y values of that clip as well as the scale (simulating a camera that keeps both characters in focus).

View 2 Replies

ActionScript 2.0 :: HitTest - Detect Collisions Between Movie Clips And A Line

Nov 26, 2004

How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.

View 1 Replies

ActionScript 2.0 :: .onEnterFrame And HitTest Now Apply To The Clips Attached To The Original Clip?

Jan 5, 2010

say I have a clip with an onEnterFrame running on it with a hit test to check if the user has rolled off the clip . . . Then i create an empty clip within that clip and attach clips to it. Will my .onEnterFrame and hitTest now apply to the clips i have attached to the original clip?

View 2 Replies

ActionScript 2.0 :: [FMX] Game - Hittest With Movie Clips In The Centre Of The Stage And Distance

Apr 26, 2005

i am working on a game called "virus". you click somewhere on the screen and the virus goes to where you click. you have to dodge random moving white blood cells, and if you hit them you lose. everything is working. except for one thing. scoring.

i have made a movieclip with a dynamic textbox in (score), and in the movie clip there is a section where the number in the score textbox goes up really quickly, a section where is goes up medium, and a section where it goes up slowly. i want to make it so that when you get closer to the center of the movie, for the score to go up quicly, and slower as you get further out. i have tried hittest with movie clips in the centre of the stage, but it doesnt seem to work.

View 3 Replies

ActionScript 2.0 :: CS3 To HitTest Within An Array?

Jul 22, 2011

I have this thing where orbs are supposed to stick together, so I put them all in an arrayand told them to stick together when they encounter another member of that array.However, they only stick in groups of up to four, and then the orbs begin to overlap and such.

View 2 Replies

ActionScript 3.0 :: E.currentTarget - Trigger A Tween For Everything Else In The Array?

Feb 17, 2010

I have a function which triggers a tween for the currentTarget in an array when target is clicked but how can I trigger a tween for everything else in the array??

[Code]...

View 2 Replies

ActionScript 2.0 :: Hittest Array - Allow Gravity

Oct 15, 2010

I'm making a game were parts of the level are randomly generated and move across the screen and while I have made it so all that works correctly I am having trouble running a hittest on them to allow for gravity. Below is the piece of code attached to the player movieclip that I think is causing the issue (shortened for sake of space)

[Code]...

View 3 Replies

ActionScript 2.0 :: Call An Array From A HitTest?

Aug 10, 2003

I'm trying to make two duplicated movie clips check for any of the others ie bullet239 hitting badguy92

View 12 Replies

ActionScript 3.0 :: Hittest Will Not Work In Array?

Feb 18, 2009

I am trying to use the following code to simplify multiple Hittests using an Array, but the code won't work. Can anyone tell me why?

var blockArray:Array = new Array("block1", "block2", "block3");
player.addEventListener(Event.ENTER_FRAME, blockTest);
function blockTest(evt:Event):void {

[Code].....

View 4 Replies

ActionScript 2.0 :: Unable To Trigger The Instances Form Array

Jul 23, 2006

i got a array which stores some elements, in string form, and these elements actually represent the name of the instances on the stage. now i want to trigger the instance to reset it's alpha value..

eg: i got an array["A"."B"."C"];Instances name available: A,B,C,D....Znow how i should do to make the instance A to got triggered?? i call them by using on button. i try some like _root.name.array[0]=_alpha=0; but not success.

View 10 Replies

ActionScript 3.0 :: HitTest On Array Object - Using RemoveEventListener?

Apr 6, 2010

I was using hitTest to see when sunny (mc) would hit one of five objects I have in an array. But I had to use removeEventListener otherwise it would keep occurring. But now I can't "hit" the next object. Why doesn't the addeventListener work again?

stage.addEventListener(MouseEvent.CLICK, myClickReaction);
// speeds ALONG NYPOTENUSEvar v:Number=5;
var varObject:String;
var i:Number;
var arrayObjects:Array;
[Code] .....

View 4 Replies

ActionScript 3.0 :: Apply Hittest Object Between Two Array?

Dec 5, 2009

adding multiple childs to an array these childs are added using timer after a time interval.actually there two classes and child of both classes are added to stage one through timer as i described and other through keyboard event. now is it possible to do this if yes than how?? and is it possible to apply hittest object between these two array.

View 6 Replies

ActionScript 3.0 :: HitTest - Object Detection / Looping Through Array

Oct 14, 2011

I've attached a zip with a few custom classes and a .FLA. Ignore the custom classes. I'm getting repeated
"Error #1009: Cannot access a property or method of a null object reference. at Environment_fla::MainTimeline/hitTest()".

I understand that this error means I'm asking it to reference something that's no longer there. How better to hitTest many objects in an array. My game involves creating a bunch of balls that will fall into buckets. I need to keep track of how many touched the buckets, how many fell off the screen, and remove each accordingly.

Here is the code from my main FLA
ActionScript Code:
var ballTimer:Timer = new Timer(200);
var changeTimer:Timer = new Timer(50000);
ballTimer.addEventListener(TimerEvent.TIMER, throwBall, false, 0, true);
ballTimer.start();
changeTimer.addEventListener(TimerEvent.TIMER, changeColor);
changeTimer.start();
[Code] .....

View 6 Replies

ActionScript 2.0 :: Use Names Inside Array As Hittest Values

Dec 13, 2004

I have a simple FOR loop which runs through an array of MC names, which runs fine, but I'm trying to use these names inside this array as hittest values. So, I have one MC, and the code in this MC runs through an array and checks for any collisions between it and the mc in the array.

[Code]...

View 6 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 3.0 :: Adding Child To An Array And Applying Hittest Object?

Mar 20, 2012

regarding adding multiple childs to an array these childs are added using timer after a time interval.actually there two classes and child of both classes are added to stage one through timer as i described and other through keyboard event. now is it possible to do this if yes than how?? and is it possible to apply hittest object between these two array.

View 6 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 :: MX: Trigger A MC Then Wait Then Trigger Another?

Aug 23, 2005

I have an application done in flash- on the main Scene Level, everything has only one frame but I have MCs and the like that are triggered by actionscript.There are quite a few nested functions on the main actions layer as well as an "onEnterFrame" function that reloads XML data in the background, etc... but that is not the problem.

The problem is, that at one point, I am calling a few MCs that kind of close up a section of the page like blinds- and then I want a text to appear ontop of that now closed area... but if I just write...

Code:
_root.TimelineFader.BlendeT1.gotoAndPlay(2);
_root.TimelineFader.BlendeT2.gotoAndPlay(2);
_root.TextAboveTimeline.theMessage_txt._visible = true;

...it all happens simultaneously, of course.I guess I could check for "BlendeT1"'s (or T2's) current frame (since it's an MC)... but how do I wait while that MC runs / until it reached a certain frame? How can I keep the rest of the actionscript in the main function from continuing?

View 5 Replies

ActionScript 3.0 :: Getting Clips Into Array?

Apr 11, 2011

I'm working on a document class for a big project, wherein a swf has graphics on its stage, and it loads its corresponding sound file and captioning xml. Some of these swfs have buttons, and because it will undoubtedly be edited several times, we want those buttons to be assigned their URLs through JavaScript. The pages with buttons don't always have the same quantity of buttons.

So I'm trying to figure out how to get the buttons into an array so that I can add event listeners and say arrButton[0] goes to URL[0]. I tried just writing the array in, and it didn't like that, and I can't figure out how to push them into the array because they are not dynamically placed - they are on the stage with instance names. I thought perhaps I could use stage.numChildren to do it, but it only traces 1 child when 3 buttons are on the stage.

View 3 Replies







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