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
Similar Posts:
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
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
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
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
Feb 8, 2010
i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
[code].....
View 1 Replies
Mar 9, 2010
basically i'm trying to get something like this;
Code:
on (release) {
gotoAndPlay(1-30);
[code]....
View 1 Replies
Mar 11, 2010
I am currently creating a project in flash. Basically I have nearly a hundred frames. I want my next button to play scene 90 to 100 and then play 60-80 after the previous one has finished. I have already put action script in the top layer to make sure it will stop at 100 and stop at 80 but i cant get them to play after each other. I haven't a clue of what function to use only go to and play but then they would play at the same time right?
View 2 Replies
Jun 21, 2009
How can I get a movie clip to play when pressing the right arrow key? The movie clip is called helicopter and it has stop(); on its first frame (with an animation following).
Here is the loop that tells the arrow keys what to do when pressed:
public function loop(e:Event) : void
{
vy += gravity;
y += vy;
[Code]....
View 5 Replies
Oct 22, 2009
hen you click on a button within my swf it loads an external swf into an MC that sits on top of the 1st swf, which continues to play underneath.Within swf2 I have lots of pages that you can navigate to, which works fine on its own, but not when I try to play it through swf1.When I click on any of the navigation buttons they don't work.I've tried making an MC within swf2, putting all the pages in there and on the navigation buttons doing:
on(release){
_root.swf2MC.gotoAndPlay("frame");
}
[code]....
View 2 Replies
Feb 28, 2005
I am trying to perform a simple jump on a button with this basic code,
on(release) {
gotoAndPlay("ToMain");
}
This works most of the time. Other times it simply skips the jump and continues on. This jump is aimed to skip over an intro (so heavy image transitions with music and commentaries added). I am guessing the intense cpu processing is the cause of the skip. Is there a sure way of performing this jump?
View 3 Replies
May 14, 2009
I have a movie clip called frog who moves along the screen, I want him to jump when he hits any other movie clips. I can make him do so with the code below, the problem is that if I write the same function for the other movie clips it doesnt work, it still works on the first one but none others. I have tried attaching an onCilpEvent on both the frog and on all the other movie cilps so no avail.
function hitBaby(){
if(_root.babyWord.hitTest(_root.frog)){
_root.frog.gotoAndPlay("frogB");}else{ _root.frog.gotoAndPlay("frogA");}
[code]....
View 3 Replies
Apr 22, 2009
On the same frame, I have two buttons - one with alpha transparency above an image, and one regular one. Both have the " on (release) { gotoAndPlay (2) ; }" code. The transparent one doesn't work, but the other one does.
View 2 Replies
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
Feb 4, 2010
I've got a movie clip and at the final frame of the clip, I have an action to make it go back but to a frame label and I've tried a number of different versions of the GotoAndPlay action and none work. They're all being ignored and I don't get it. Here's what I've tried:
this.gotoAndPlay("32");
this.gotoAndPlay("start");
gotoAndPlay(32);
gotoAndPlay("start");
View 1 Replies
Feb 14, 2009
I'm having problems with my animation getting cut of by my navigateToURL code. What is supposed to happen is,If you click on "buttonBtn" it triggers a animation. At the end of the animation it is supposed to stop and bring up a url. I've used gotoAndPlay ("frm") and navigateToUrl. Each time I test it in the browser the animation will begin, but the url comes up before the animation is finished. How do I allow the animation to play all the way through and then retrieve the url?
stop();
//SimpleButton ButtonBtn;
function handleClick( pEvent:MouseEvent):void
{
[code]....
View 9 Replies
Apr 21, 2009
I have a preloader that loads an external .swf. Problem is, it doesn't show the .swf until it is 100% loaded. But, the external .swf starts to play before it reaches 100%. I placed a stop function in the external .swf so now, after it loads 100% it is still on the first frame. How do I get it to automatically goToAndPlay the second frame?
Also, when the external .swf reaches the end, it needs to loop back. I am guessing that I will have the same problem after it reaches the end, loops back to first frame and stops again.
View 6 Replies
Sep 28, 2009
I've got a simple button that when clicked needs to go to a particular frame and stop when it hits the stop(); however when I test it I get a type error #1009 Cannot access a property or method of a null object reference. at PostCard_fla::MainTimeline/frame25()
I need to be able to tell it what frames to go to manually so the user can jump around the time line using short animated transitions between pages (set up like a web page) in AC2.0 this was easy, but its different in AC3 and I'm not quite sure what I'm doing wrong.
This is my code:
stop();
btn_flip.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void{
gotoAndPlay(28);
};
View 1 Replies
Jul 5, 2010
On my first frame, I have: 6 buttons (p1 through p6). A holder mc_holder, which holds mc_pages, {a movie clip that shows 6 pages (each their own movie clip, page1 though page6) tweened across the screen, made to look as if the pages are being "flipped" through).
The following code:
Code:stop();
var _holder = mc_holder.mc_pages;
var picked;p1.goal = 1;
p1.onRelease = goPage;
p2.goal = 10;
[Code] .....
The problem is, as soon as the movie loads, ALL these animations begin to play. I am looking for a solution so that the animations will not play until the page is viewed. I am thinking I can put a stop on the first frame of each page, and a frame label ("go") on the second frame. Can I add this (my knowledge is limited but say... gotoAndPlay (go")) to the code shown above? I have tried messing around with it but have not yet had any results.
View 3 Replies
Sep 9, 2010
I'm having trouble getting a game to go to the end scene after a collison with a barrier.
Code:
function dead() {
clearInterval(ants); //stop spawning
[code].....
View 8 Replies
Apr 8, 2009
I am trying to go about a "smarter" way of setting up multi paged full flash sites. This has got to be something very simple that i can't seem to put my finger on.
I'm trying to create a variable called 'currentScen' that i can declare off the start and change depending on what page the viewer goes to in the site.
I could put a bunch of 'if' statements saying that 'if the current page is this page then do this, if it's this page do this' etc. for each individual page but i thought there must be an easier way.
I am trying to get the following to work:
Code:
// declaring what the starting page is
var currentScen:String = "welcomeMovie";
//function fading in called page with animation used on the 'over' frame label
function animateOn(page:String) {
[Code].....
View 1 Replies
Mar 2, 2011
I have a movieclip with labels "normal" and "mouseover" . I am using the following code :
var thisButton:MovieClip = this.getChildByName(e.currentTarget.name) as MovieClip;
thisButton.gotoAndPlay("mouseOver");
On debugging "thisButton" does goto mouseover and the frame changes. But visually there is no change and the animation is not played.
View 1 Replies
Nov 25, 2011
I'm trying to gotoAndPlay using AS3 in a certain frame inside a symbol, my target frame is inside another symbol which is "Carrera" (class name). Both symbols where placed on the scene by dragging from the library.
I've tried with:
MovieClip(carrera).gotoAndPlay(1);
Error Output:
TypeError: Error #1034: Type Coercion failed: cannot convert carrera$ to flash.display.MovieClip.
at fondoUcreativa/frame500()
Also tried with:
carrera.gotoAndPlay(1);
Compiler Error:Symbol 'fondo Ucreativa', Layer 'Layer 2', Frame 500, Line 4 1061: Call to a possibly undefined method gotoAndPlay through a reference with static type Class.
View 2 Replies
Feb 3, 2009
Is there any way to disable the gotoAndPlay? I currently have a drop target and when I drop a movie clip on the target it runs the gotoAndPlay, but when I drop the movie clip on the target again it runs the gotoAndPlay. I don't want this to happen.How would I get the gotoAndPlay to run once, so that when i drop on the target again nothing happens.
View 3 Replies
Feb 15, 2009
Maybe someone in this forum can give me some help. Here is what I'm trying to do... I have page that when you click any of the buttons, it triggers the same animation. Now, depending on which button you click, it will take you to a different url. My problem is, with the code I have, the animation gets cut off before it's finished and goes straight to the url. I know I need some type of listener or something to watch for the end of the animation before going to the url. I can't seem to figure out what that code is or where it needs to go. Also, my animation is not in a movie clip. It's all in Scene 1. I've got the following script in the first frame of the actions layer. I'm only about three weeks into self-teaching AS3, so tell me like a third grader what is up.[code]
View 1 Replies
Jul 17, 2009
This is what I want to do:
- Pass a variable to a SWF. It can be 1, 2 or undefined.
- Read the variable and jump to a frame in the movie depending on the value.
[code]I know flash reads the "URLvariable": I checked it by displaying in a text field... but the gotoAndPlay sentences doesn't work! Instead of it, Flash continues playing the timeline.
View 3 Replies
Jul 30, 2011
I've got all the major peices of my project but I need a steering wheel! I'm not sure how to enable the functionality of the app. Let me try to explain: I have 2 working getTimer timers in 2 class files. One is a 15 minute countdown timer. The other is a timer to call animations, but (here's the problem)i have 4 different sets of animations to call based on the users button selection. They are added to the stage with
ActionScript Code:
var countdown:CountDown = new CountDown(time_txt);//where time_txt is a TextField on the stage
addChild(countdown);
var Alerts:sniperAlerts = new sniperAlerts();
addChild(Alerts);
They kinda have to be called to the stage in this manner because I have some buttons that alter the time on the fly based on the Alerts and countdown var. I tried having 4 different alert files, but you can't declare them all as the Alerts var if you use different frames. In addition you can't repeatedly call the countdown timer as the same var because of namespace. I wish I knew how to make menu_mc to pass an argument to the stage that selects which animation set the alerts timer will process. Here's the alert timer with 1 set of animations to call:
[Code]...
View 0 Replies
May 8, 2004
I'm tyring to do something a little complicated and I was hoping for some expertise I'm using a timer which triggers a gotoAndPlay after 5 secs. It works fine but I am now trying to work out if it is possible that if I press a button I would be able to stall the timer. i.e the goToAndPlay only happens after 5 sec otherwise the it is prevented and the the timer goes back to zero.
I know its a bit difficult to describe but I have attatched the .fla to help you see what I mean.
In terms of the code I'm using:
[Code]...
View 2 Replies
Jun 8, 2004
I'm getting data from a database and I put this data in an array that looks like this:
me, you, he, she
Now I want this data to be put in an dynamic text field like this
me
you
he
she
and they all have the option to click on it and do things like this
for me:
Code:
on (release){
gotoAndPlay (20);
}[code]....
View 3 Replies
Sep 21, 2005
Im working on a flash menu right now and I wan to create a dynamic gotoAndPlay. but I need to insert a variable into the target path right now here is what Im doing.
Code:
MyVar="FirstMC";
_root.Nav.MyVar.gotoAndPlay("out");
and right now Flash doesn know what to do with it... I would like to make this variable global also which is nothing more than throwing the _global command before my variable right?
View 2 Replies