ActionScript 1/2 :: Create HitTest And GotoAndPlay MovieClip

Jul 21, 2011

I have three symbols. First is a Shield MovieClip, where in the first frame I have placed a stop(); Action and the second frame is where the animation starts..Second is a Ship and third is a PowerUp. Inside the Ship symbol, I placed the Shield MovieClip. I wanted to create a hitTest when the Ship hits the PowerUp, the Shield MovieClip inside of the Ship will start playing.

This is my code that doesn't work:
if(this.hitTest(_root.ship)) {
root.Ship.Shield.gotoAndPlay(2);
}

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Create An "hitTest" Script Inside A Movieclip That Is Actually Part Of That HitTest Code?

Jan 15, 2009

i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).

View 1 Replies

ActionScript 2.0 :: HitTest And Positioning - Create An Invisible Movieclip That Has The Exact Size And Shape Of The Animated Movieclip

Aug 23, 2005

This is the third thread I've written for my current project (1st was answered perfectly, 2nd failed [but I still figured it out anyways]) but I'm not sure if there is a solution to this problem. I can't really explain my problem, so once again I've included a helpful animation to show you what I mean. Bear in mind that the pale-blue box represents the movie clip's borders, and those borders are usually changed to include the animation (instead of the borders moving with the animation, the borders get bigger).

For the animation problem, I've already got a solution: create an invisible movie clip that has the exact size and shape of the animated movie clip and make it follow the movie clip as it animates, and make the hitTest check the invisible movie clip instead of the animated one. As for the rotation problem, well, I don't know how to fix it. Is there a way to change that?

View 1 Replies

ActionScript 1/2 :: GotoAndplay On HitTest?

Sep 8, 2010

I'm trying to make it so that when a movieclip (box) touches another movieclip (exit), it goes to frame 2.I've made it so that (box) moves with the arrow keys and doesn't go pat the barriers (boulders) using this:

x.onEnterFrame = function()
if (Key.isDown(Key.RIGHT)) {box._x += 5;}
if (Key.isDown(Key.LEFT)) {box._x -= 5;}

[code]....

View 2 Replies

ActionScript 1/2 :: HitTest GoToAndPlay(2) - Play The Movie

Sep 26, 2010

when my character hits a certain object, I want it to play the movie. BUT since the hitTest is techincally always true if my character is just sitting on the object the entire time, it continuosly player frame #2. What is the simple fix for this? The code that will just play movie clip ONE TIME, and not restart continuosuly?

View 1 Replies

ActionScript 2.0 :: Create A GotoAndPlay Function?

Dec 28, 2007

is it possible to create a gotoAndPlay function?would this be valid?

_root.gotoAndPlay = function(){
}

View 1 Replies

ActionScript 2.0 :: HitTest - Create A Pop-up Menu - RollOver Or RollOut Tags

Jul 14, 2005

I'm trying to create a pop-up menu. I've gotten it to work, however, I'm using an invisable button to control when the mouse is over, or when it leaves so that the menu will hide itself back down. It seems that when I but a button or ANYTHING using the rollOver or rollOut tags that it messes with the invisable button and hides the menu. I figure I need a hitTest?

View 5 Replies

ActionScript 2.0 :: Create A Hit Area Using HitTest So That It Stops Scrolling When You Aren't Over It?

Jan 24, 2006

I have a scrolling MC that moves L&R according to the mouse position L+R of center and I need to create a hit area using actionScript's hitTest so that it stops scrolling when you aren't over it.

View 3 Replies

ActionScript 3.0 :: How To GotoAndPlay Another Movieclip

Sep 27, 2009

im using as3 to make buttons, and basically when you click on something, all other tabs close, i can not get this to work....

invisible.addEventListener(MouseEvent.CLICK, fn_tab3_1); // invisible is the invisible button, mouse move in this area triggering this event//
function fn_tab3_1(event:MouseEvent){

[code]....

View 2 Replies

ActionScript 3.0 :: GotoAndPlay From Different Movieclip?

Feb 22, 2009

I have a movieclip on the stage instance name: "man_mc"and another movieclip on the stage named: "tree_mc"At the end of the timeline in "man_mc" I want to call the"tree_mc" to gotoAndPlay('fall').I've tried tree_mc.gotoAndPlay('fall'); and a few others

View 3 Replies

ActionScript 1/2 :: HitTest The Same Movieclip?

Sep 4, 2011

_root["zombie"+i].onEnterFrame = function() {
if(this.hitTest(this)){
trace("hit!");
}
}
 
This does not work, it traces hit! even if none of the movieclips are touching. dont know how else I can do this.

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

Flash 9 :: Gotoandplay Using A Button Or Movieclip In AS3?

Aug 23, 2008

I have a video that starts after an introduction is played.it plays fine but my members are asking for a non autoplay video. So I'm trying to put a "start video" button or movieclip to start the video manually.

View 1 Replies

ActionScript 3.0 :: GotoAndPlay WITHOUT A Button Or Movieclip?

Oct 9, 2009

Is there a simple gotoAndPlay code to tell a scene what scene to go upon completition?I know they automatically go to the next scene in the timeline, but I have multiple scenes that I want to play through and all link to the same scene. I want to do this without a stop(); and without the user having to click a button or movieclip...

View 1 Replies

ActionScript 2.0 :: GotoAndPlay Next Scene Within MovieClip

Jun 23, 2010

I want to have an animated button that go's to the next scene and plays. This is the code I have on the button inside the movie clip:

ActionScript Code:
on (rollOver) {
gotoAndPlay("rollover");
} on (rollOut) {
gotoAndPlay("rollout");
} on (release) {
gotoAndPlay("Scene 2", 1);
}

For some reason this doesn't work? Is the problem that the code on the button is within a movie clip?

View 9 Replies

ActionScript 2.0 :: GotoAndPlay Inside A Movieclip

Apr 28, 2005

In the game there is a scene (called scene 1) in that scene there is a movieclip.. Inside that movieclip there is alot of frames, and on the last frame there shall be a gotoAndPlay script that makes you go to scene 2 that is outside the movieclip... I have tried with gotoAndPlay("Scene 2", 1); and stuff, but it doesn't work

View 3 Replies

ActionScript 3.0 :: Triggering GotoAndPlay From Within MovieClip?

Apr 2, 2008

How do I trigger gotoAndPlay(1, "Scene 2") from within a MovieClip?

View 3 Replies

ActionScript 2.0 :: GotoAndPlay Inside A Movieclip?

Apr 28, 2005

In the game there is a scene (called scene 1) in that scene there is a movieclip.. Inside that movieclip there is alot of frames, and on the last frame there shall be a gotoAndPlay script that makes you go to scene 2 that is outside the movieclip... I have tried with gotoAndPlay("Scene 2", 1); and stuff, but it doesn't work

View 3 Replies

ActionScript 2.0 :: Current Movieclip With Hittest

May 15, 2009

I'm setting up a project that has a list of 45 words. The user should be able to drag the words into an area on the stage, as many as they want, but unable to proceed until they have only 5 words in the selected area. I started off by making each word a movieclip and making them draggable, but wondered if there was a way to simplify the code rather than putting it on all 45 movieclips, if there was a way to have it know which one i'm currently dragging.

Then I was unsure how to keep track of how many were in the area. If i have a count that gets increased for each hittest, it goes up and up, but you can continually redrag the same word on which is wrong. But the user needs to be able to drag words out, so I can't disable them when they hit.

[Code].....

View 10 Replies

ActionScript 3.0 :: Allow HitTest Of MovieClip To Hit Only One Object?

Jul 19, 2010

Is there a way that only allow hittest of a mc to hit one objects, if it hit multiple object it ignore it?

View 1 Replies

ActionScript 3.0 :: After MovieClip Finishes GotoAndPlay Frame?

Apr 1, 2010

How to jump to a frame (gotoAndPlay) on the ROOT (or any frame anywhere) right after a movie clip is done playing. This is AS3 on Flash CS4.

View 9 Replies

ActionScript 2.0 :: GotoAndPlay - MovieClip On 3rd Frame Not Playing

Aug 3, 2004

I'm making a flash site but I'm having a little problem: I preload my site with this code:
Code:
bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded / bytes_total;
this.loadBar._width = getPercent * 200;
this.loadText = Math.round(getPercent * 100) + "%";
if(bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}
This code works perfectly when I test it, but if it goes to frame 3, the MC's on that frame won't start playing... ? If I just remove the frames with the preload bar (so frame 3 becomes frame 1), all works perfectly...

View 3 Replies

ActionScript 3.0 :: GotoAndPlay MovieClip On Stage At Certain Time?

Oct 12, 2010

I am trying to get a movieclip that is on the stage to play at a certain time. it isn't working (not getting errors) and I'm so lost. The odd thing is, it is not just not doing it, but doing something else: it is going to the frame and stopping.

View 5 Replies

ActionScript 2.0 :: Microphone Triggered To GotoAndPlay Movieclip?

Jun 15, 2011

I have attempted with little (read as: none) success in having movieclip(s) play when triggered via Microphone activity/silence level. I would like to have the microphone act as a simple trigger that plays movieclip(A) depending on silence cut off level and loudness of microphone input.

If The mic user were to speak into the mic relatively loud, movieclip(A) would play.As soon as the mic level decreases; movieclip(A) would either play in reverse, or play another movieclip. (MOVIECLIP B) .The idea is to have an simple animated mouth open and close in time to microphone input.

View 2 Replies

ActionScript 2.0 :: GotoandPlay In Movieclip - Image To Fade In And Out

Nov 21, 2004

I'm using movie clips to make buttons because I want a image to fade in and out. When you click on it it should jump to a different frame but it does not happen. I'm not should if it's trying to go in to the frame in the movie clip or or not. How do I get that movie clip when I use the on release to gotoandplay on the main sence and not the movie clip? There was an image in the background but for size, I had to delete it to upload it. Not important but pointing it out for some reason.

View 3 Replies

ActionScript 3.0 :: Hittest On Dynamicly Created Movieclip

Jun 16, 2009

this i have this code at the moment and i want to add a hittest to the "bullet".i have created.[code]but this doesn't seem to work.

View 3 Replies

ActionScript 1/2 :: Restart Ball MovieClip After HitTest

Feb 13, 2011

I have recently started to learn about flash and as2 and I am working on a small shooting style game. I have managed to create a hero that moves around the screen and enemies which I shoot at. The issue I am currently having is that on my ball movieclip (bullett) the first frame holds a ball and the 2nd frame is a small animation of the ball breaking apart. So basically when the ball is thrown and the hittest comes back true the 2nd frame plays showing ball breaking apart. Now when I fire a 2nd time it constantly plays the 2nd frame of the broken ball. How can I restart the ball movieclip in its 1st frame to carry on shooting normally.

Below is the as2 I have on my ball movie clip.
onClipEvent (load) {
var statee;
statee = "ready";
maxJump = -30;
grav = 0;
gravity = 1.5;
[Code] .....

View 4 Replies

ActionScript 3.0 :: Using HitTest From Within Class With MovieClip On Stage?

Aug 26, 2011

I'm getting really tired of AS3 now because I cant get it to do basic things like hit tests which were so easy in AS2. Basically, I generate a number of fish of varying scale, speeds and directions using this on the first frame of the timeline and the constructor function in the fish.as file:

ActionScript Code:
function DisplayFish() {
for (var i:int = 0; i < 20; i++) {
var newFish:fish = new fish();
this.addChild(newFish);
[Code] .....

What I want to do is rather than setting a max / min x/y use a hit test with a side wall MC on the stage, and a hit test between this instance of fish and all other fishes so they bounce off each other. I've tried so many ways of hit testing from within the class with MCs on stage but just cant get it to work.
ActionScript Code:
if(this.hitTestObject(root.LeftWall)){
directionX = 1;
}

View 6 Replies

ActionScript 2.0 :: Goto And Play Scene - _root.gotoandplay And Even Scene1.gotoandplay Won't Work?

Nov 9, 2007

For some reason i'm having problems swapping scenes in my flash movie. At first i put the action in a "actions" named layer and a link to a button. So basicly when scene1 loads the frame 1 action is "stop ();". The viewer clicks on button1 which has a code of;

[Code]...

View 1 Replies

Flash8 :: Button Outside A Movieclip To "gotoandplay" Inside The Movieclip?

Aug 12, 2010

I have a frame with a movieclip in it (named "theclip" in the library and has the instance name of "guy"). The movieclip has two frames with stops on them. The second frame inside this movieclip has the label "guy2"

Now back in the basic frame i also have a button (outside the guy movieclip) that i'd like when i press it it jumps to the "guy2" frame of the "guy" movieclip.

Code:
on (release) {
gotoAndPlay("guy2");
}

what do i add to the script that makes it refer to the movieclip? Is there a line like the _root or _parent and so on?

View 1 Replies







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