ActionScript 3.0 :: Use GotoAndPlay But That Dooesn't Work ?
Dec 18, 2010
I made simple banner which consists of pictures and symbols. Now I want it to jump from the last frame to first one. I tried to put simply gotoandplay(1); but that dooesn't work. What's wrong?
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;
For some reason, the gotoAndPlay command in one of my frames won't work properly (I think that's the problematic command, but maybe it's another one in the movie).
Frame 1 consists of a button instance named "menu", which is a text reading "menu". When pressed, the animation starts playing and several menu options appear in a frame-by-frame animation, which lasts up to frame 7 where the movie stops.When the "menu" instance is pressed again, the playhead is released and the movie plays another frame-by-frame animation (from frames 8 to 16) of the menu options disappearing.So, in frame 16 there appears only the "menu" instance - just like in frame 1.
All of the above works fine.What I want to do is tell the player to go back to frame 1 as soon as it reaches frame 16, so the menu can open up again when the instance is pressed.I put this code in frame 16:gotoAndPlay(1)and it seems to be working fine, but when I press the "menu" instance for the third time (meaning, after it has already opened up and closed one time), the movie starts playing from frame 8 for some reason.
I'm not familiar with AS3 at all.I'm working on a simple 2 minute presentation. For testing purposes, I have a layer named "label" that I am using to set a label called "test" (currently it's on frame 1445)I'm trying to put an action in the timeline, frame 1, that will cause the play head to automatically jump to the "test" label so as I build the presentation and test it, I don't have to sit through the entire thing just to see if my latest animations are working as expected. I'd like to move this "test" label down the timeline as I continue to build new parts of the presentation. I would expect this code to jump the play-head to where ever I put that "test" label..Instead, it either doesn't work at all, or it jumps to some other random spot around frame 160. NO other labels are being used in this presentation (I'm using the FlashEff component plugin for effects, in case that info is necessary)
I have a scene for the title screen and a scene for the game itself. On the title screen i have a start button, that when clicked it is supposed to go to the game scene; but for some reason this wont work.
actions for startclick (start) on(release){ gotoAndPlay("Game", 1); }
I have made a simple animation using only the timeline. The animation is covered by a button "Knapp" (alpha 0) wich activates the actions. The whole thing works fine the first time. The last action says go to and play frame 2, wich has two actions: stop + go to and play frame 4. But this action does not work the second time. I tried to set the action to frame 3 instead of 2 and the same problem occured on another action on the timeline as well.
Here is the last action on my timeline:
Knapp.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_11); function fl_ClickToGoToAndPlayFromFrame_11(event:MouseEvent):void{ gotoAndPlay(2);}
XML text to be used as a link within my flash site.What I mean by this is I have a XML file with a list of shows and at the end of each title and short description and I would like to have a link to the show's dedicated page.I know how to do a URL link but a gotoAndPlay / Stop link doesn't seem to work the same way.. Here is an example of what I mean:
Show Name 1: Short description link to dedicated 'page'[code]....
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?
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;
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:
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?
I am trying to defeat my psychological block with dynamically loaded fonts in AS3, and I have an annoying problem. I am creating a clock with a textfield and I am loading fonts from a SWF library: the available classes/linkages are "Arial", "ArialBold", "MyriadPro", "MyriadProBold" and "Verdana".This is the line where I get the class from the SWF, and it extracts the class correctly
Code: clock = new Clock( { fontClass: assetsLoader.getFontClass("skin", "Arial") } ); The constructor...
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.
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){
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:
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 {
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.
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); };
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.
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;}
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) {
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.
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.