ActionScript 3.0 :: Flash - Gotoandplay Randomly One Of Three Frames?

Aug 19, 2010

here is what I am trying to achieve in as3 in as2:

Code:
var randomNumber = Math.floor(Math.random()*3)
if (randomNumber == 0){
gotoAndPlay(1);

[Code]....

on frame 1, 30 and 60 there is a different animation, with this code at the end of each animation it randomly chooses one of the optional frames to play from.

View 8 Replies


Similar Posts:


Flash 8 :: GotoAndPlay - Loop Function Between Frames

Jun 13, 2011

I am working with some actionscript that are spread out amongst different frames, and having changing conditions, determines whether to end the sequence (gotoAndStop(1)) or continue (gotoAndPlay(5))

(For easy example):
frame 4=
x=1
frame 5 =
x=x+1
frame 6 =
if (x=10){
gotoAndStop(1)
}else{
gotoAndPlay(5)
}

I understand this easy example could be done several ways on one frame easily, (while x<10, etc).. but my code is so long and complicated, that the way I wrote it, it was easier to have it sort of "loop" between frames. The problem with this is, I think the frame jumping is slowing the coding down. I tried functions, (like having all coding in frame 5 as a function, then calling that function with the "else" in frame 6), but that would only run the function once.. I need it to keep looping.

View 2 Replies

ActionScript 3.0 :: Buttons - GotoAndPlay At Different Frames

Mar 19, 2009

I got 2 buttons that i want them to gotoAndPlay at different frames... here is the code

[Code]...

when i play the .swf i get an error message

View 3 Replies

GotoAndPlay And Then Skip Frames In Timeline?

Jul 25, 2009

I am looking for an actionscript that will go to a certain frame in the timeline, play several frames and then jump to another frame in the timeline. Basically, I want to use this on several different buttons that use the same animation sequence to get to another part of the timeline.

The following is a scenario, but not script:
Buttons A and B are on Frame 1. Animation is on Frames 2-20:
When Button A is pressed, go to Frame 2. Play Frames 2-20, then go to Frame 21.
When Button B is pressed, go to Frame 2. Play Frames 2-20, then go to Frame 22.
I am currently doing this in a different way.

Buttons A and B are on Frame 1. Animations for Buttons A and B are the same, but are located on different frames. Animations for Button A would be on Frames 2-20. Animations for Button B would be on Frames 21-39. So...
When Button A is pressed, go to Frame 2. Play Frames 2-20 and stop on Frame 20.
When Button B is pressed, go to Frame 21. Play frames 21-39 and stop on Frame 39.

Do I have to create this extra timeline? Can I just put the animation in a separate movie? How can I play the movie and then connect each button to different parts of the timeline after the movie ends?

View 5 Replies

ActionScript 3.0 :: GotoAndPlay(); Going To Random Frames?

Sep 29, 2009

created a (what I thought was simple) gallery.I have all the large images on a timeline layer were each image fades in over the course of half a second then stops. I created navigation buttons, next and previous on each frame that are supposed to navigate to the next image. The action script for the nav buttons is different depending on which image (frames) you are on. However, when I publish the swf the next and previous buttons don't go to the frames I prescribe for them in Actionscript, but just go to random frames in the timeline. Also, I have a series of thumbnails that have actionscript that navigates to pictures/frames when clicked so I don't know if they are interacting badly. Does anyone have any idea whats going on?Here's an example of the AS for the previous and next buttons (instance names prev_btn and next_btn):

prev_btn.addEventListener(MouseEvent.CLICK, navback1);
function navback1 (event)
{

[code].....

View 2 Replies

Actionscript 3.0 :: Have A Button GoToAndPlay A Few Frames Only?

Apr 7, 2010

It seems like no matter where I check, there isn't a clear answer to this particular issue.Rather than blabber on about the code, I think it is important for me to address that I may just not be setting up my document correctly. At present, I created several layers, some in folders, for a basic portfolio website. I have my problems with my main buttons, in my "Sections" folder, where each button is a distinctive layer so it can be animated when it is pressed.I have a button called 'architecture' that is pressed, but instead of just statically moving the frame to the desired content, I want to play 5-7 frames that I tweened for a small transition (sometimes opacity, sometimes sliding mask) that occurs right before the content. All my transitions and everything is just on this one main timeline.

Basically, I sort of want to have the best of both worlds, where I can goToAndPlay, but then stop it at the end of that segment, as to not run into my next frames of content.My first solution was to simply place a stop(); at the end of the transition, but then the menu just locks and stops. Of course this was on my top layer named 'actions.'I then tried applying each event listener to it's buttons' layers, but that resulted in the button simply not working.I segmented up the actions layer into keyframes, but then realized that it didn't call on the event listeners if I did that.

View 2 Replies

ActionScript 3.0 :: Go Randomly Between Frames?

Aug 8, 2009

I have a movie clip divided into three scetions. The first section starts on frame 6, the next on frame 11 and the last on frame 16. Is there a way to get flash to choose randomly between only those frames (6,11,16)and not the frames in between(1-5,7-10,12-15)?

View 4 Replies

ActionScript 3.0 :: Gotoandplay - Play The Same Series Of Frames

Mar 15, 2010

We have 5 buttons that each go to another frame e.g Product, Contact etc. but we want to play the same series of frames (an outro) and then goto the frame that corresponds to the button. Weve tried lots of different examples from the already posted questions and nothing will work. The latest I tried:

[Code]...

View 10 Replies

ActionScript 3.0 :: GotoAndPlay Action Across Multiple Frames

Nov 12, 2010

I have an main.swf that loads home.swf on the stage. In home there are mc's that when clicked take you to  different frames inside home.swf I need to have a gotoAndPlay eventlistener off a button which would take the user back to frame one of home.the home .swf has 6 frames with different clips in each frame on one layer, text for the back to first frame on another layer, an invisible btn and an actions on two separate layers
 
first question :
 
the individual frames are 7-8-9 the gotoAndPlay action is on frame 7 ONLY the button only works when in frame 7 if 8-9 are not individual blanks why doesn't the button work when in frames 8 and 9?In other words can't I use an action that triggers a function assigned to a button that spans across more than one frame?if the button spans across 7 - 8 - 9 and the action frame is on 7 how can I get this to work?

View 5 Replies

ActionScript 1/2 :: GotoAndPlay Playing Two Frames When Reaching A Certain Frame?

Jan 29, 2011

Basically I have a MC called 'plane3.' Inside that MC is another MC called 'plane2.' Inside 'plane2' is an animation on frame 5.(inside the MC 'plane3' the MC 'plane2' is on a classic tween going side-to-side from frame 1 to 99, once it gets to frame 99 the code gotoAndPlay(1); makes it go on loop back to the beginning)My question is how would I go about: when you click 'plane3' it lets the tween continue playing until frame 10, then on frame 10, it gotoAndPlay (100); in the same MC and ALSO plays frame 5 from inside 'plane2'

View 5 Replies

Professional :: MouseEvent Triggered GotoAndPlay Missing Frames?

Mar 6, 2012

I am using a mouseEvent listener
 
iBubble1.addEventListener("click",doStuff);
 
to call a function that uses gotoAndPlay to send the playback head to a certain animation on the timeline.
 
function doStuff(evt:Event):void {
gotoAndPlay("popped");
}
 
Should be so simple. But the first frame of the "popped' animation, often the first 2, do not display. (when testing the compiled app, even the first 3-4 frames often do not display)Without the mouse event listener, using gotoAndPlay("popped"); to move the playback head to this animation from another spot in the timeline works just fine, so that's why I suspect the mouse event is involved in the bug.using

trace(currentFrame);

in the function after gotoAndPlay, does trace the correct first frame number of the animation, but this frame is not displayed, the animation just starts with the 2nd frame, or 3rd..or sometimes 4th.

View 1 Replies

ActionScript 2.0 :: GotoAndPlay Random Selection Between Decided Frames

Mar 19, 2010

how to literally describe what I want to achieve. But I believe it is an easy achievement for someone who is a little familiar with Actionscript (2).

I have a movieclip with backgrounds that fades in and out as the timeline within the movieclip plays. What I wanna do I place an actionscript at frame 1, before any of the background plays, that randomizes a gotoAndPlay function that jumps to a decided frames out of frame 2, 77, 152, 227, 302, 377 etc.

It should be a problem to use the same actionscript after each background has been shown? If it is, its no problem, doesnt matter too much. As long as the first background that is getting randomized is different each time you visit the website.

View 3 Replies

Professional :: GotoAndStop(); Randomly Moves To Frames

Apr 7, 2011

I'm using gotoAndStop(); for my buttons within flash using the following method:
 
myButtonInstance.onRelease = function() {
gotoAndStop("frame5");
}
 
however, I've come accross a problem where in for some reason the application will sometimes move frames when I don't want it to. For example, given the code above it would sometimes go to frame 5, but then instantly move somewhere else from there despite the code saying only to do so when a button is pressed.

View 3 Replies

ActionScript 1/2 :: Script To Move Playhead Randomly To Frames?

Apr 4, 2010

Is it possible to have a script that sends the playhead to specific frames randomly, wait for say 8 seconds then move on?For example, frames 1-20 will have an image on each frame. I want the playhead to land on those frames in a different order and keep looping.

View 11 Replies

ActionScript 2.0 :: Random Script - Playhead To Randomly Jump To Different Frames

Apr 20, 2004

I have a movie with various movie clips on certain frames. What I want is the playhead to randomly jump to different frames I specify within the movie after each Movie clip has played. So at the end of each movie clip there would be a random script forcing the playhead to play another movie clip randomly. My movie has 100 frames but I only want the random sequence to occur on the following frames 10, 13, 25, 86, 75, 56. Or If I labelled the frames how would I label them?? Would they all have to have the same label, or each label different?

View 2 Replies

IDE :: GotoAndPlay Button - Play Frames 5-10 On A Movie Clip Inside The Current Frame?

Nov 23, 2009

is there anyway to have a button play frames 5-10 on a movie clip inside the current frame, as well as skipping to...lets say...frame 10 of the scene?

i want to create a site where buttons go to different pages, but those pages have animations in and out.so if someone is in one page, and clicks a button to go to another, that page plays the "out" animation while the other page plays the "in" animation.

View 1 Replies

Actionscript 3 :: GotoAndPlay Is "sticking" On Target Frame For Two Frames?

Oct 7, 2011

This makes absolutely no sense to me.I'm calling gotoAndPlay(1) every 8 frames:

public function advance():void {
walkDistance += 2;
if(walkDistance >= 16) {

[code]....

View 1 Replies

ActionScript 2.0 :: First GotoAndPlay "the Frames" THEN Link

Jan 22, 2009

Im making an "intro" for a website.. first some picture come in and when you click one of them all picture goes to bottom of the flash.. My problem is: I need it to Frist. gotoAndPlay "the frames" THEN link.. the "movie" takes about 3 secounds.. Is there some sort of code i can use to "tell it to wait" and then link? this is what i got so far. (i know its wrong hehe)

knap.onPress = function()
{
gotoAndPlay(42);
}
if(knap._currentframe < 84) {
trace(lala);
} else {
getURL("/1_profil-.htm","_self");

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

ActionScript 2.0 :: MCs Appear Randomly From The Library And Move Around Randomly

Sep 24, 2007

Onmy stage I have a MC, and when I click it a random MC from the Library should appear and move around randomly.

I'm using this to make it move around randomly [URL]

how to make the random MCs appear from the library. And should I put the random moving script on each of my ten MC?

View 8 Replies

Flash 8 - GotoAndPlay One After Another

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

Flash :: GotoAndPlay Not Working?

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

GotoAndPlay - Flash (SWF) File Not Looping

May 7, 2009

I'm new to this actionscript stuff and I'm having trouble making my swf file loop over and over. I have several movie clips in my scene and in the last movie clip, in the "actions" layer, in the last frame, I put "gotoAndPlay(1);" hoping that this would make the file loop over and over.

Instead, I get a error message:
1120: Access of undefined property social_media_mc.
How I can make my swf loop over and over?

View 2 Replies

Flash - GotoAndPlay(1) When A Video Is Completed?

Nov 10, 2009

I am trying to create a video that can be streamed on a website. The video started with a screen grab of the video on frame one. This has the action on stop();. When this screengrab is clicked, gotoAndStop(2); is fired and the timeline moves to frame 2 and the video starts to stream. All is well... Except from when the video finishes...

When the video finishes I have tried using the code

on (complete) {
gotoAndPlay(1);
}

To go back to the origonal screen grab on frame one but it doesnt seem to budge.

View 1 Replies

Flash - Countdown From 60 To 0 Then GotoAndPlay Next Frame

Feb 24, 2010

My timer counts down from 60 to zero. I want my movie to go to the next frame at zero count. How would I make a condition to go from frame 1-2? I need to find the right operator and values, but I get lost in the strings.

What I am trying
If (something is <> == true false);
gotoAndPlay(2);
stop();
//
var timer:Timer = new Timer(100, 300);
timer.addEventListener(TimerEvent.TIMER, countdown);
[Code] ....

I'm making several experiments like this to understand conditionals. I need to build objects that function similar to preloaders.

View 3 Replies

Flash :: GotoAndPlay Not Working In Compiled .swf Or .air?

Nov 26, 2011

I have a Flash Professional CS5 project with ActionScript 3. I have a movieclip object with several gotoAndPlay ActionScript commands inside of it. I also have other gotoAndPlay commands on the main stage, linked to interactive events.

When I run the project via Ctrl+Enter, it works perfectly, without any issues. However, once I compile it down to a .swf or an Air 3.0 file, it runs, but omits some or all of the gotoAndPlay commands, both the ones inside of and outside of the stage.

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

IDE :: Create A Preloader That Plays A Certain Amount Of Frames As It Loads The Rest Of The Frames

Nov 16, 2009

I want to create a preloader that plays a certain amount of frames as it loads the rest of the frames. So, I have labels on the frames basically and need a preloader to play the "loading" frames as it is loading the "content" frames. Does that make sense? I have no idea how to even start this one... p.s. I am using AS 2.0, but if it can be done in 3.0 easier, I can switch over its no biggie

View 4 Replies

ActionScript 3.0 :: Putting Multiple Instances Of The FlvPlayback Component In Different Frames And Using Buttons To Navigate To Frames

May 2, 2011

there seems to be no accepted method of playing multiple flv using buttons. My latest attempt has me putting multiple instances of the flvPlayback component in different frames and using buttons to navigate to those frames. It works but nothing anyone has posted anywhere will result in removing the flv when you go to a different frame and instance. This was simple in AS2. Load movie to a traget and each time you load a new movie the other one goes away. REALLY goes away.

View 7 Replies

ActionScript 2.0 :: Move Frames Within A Movie Clip With Buttons On Other Frames?

Nov 24, 2011

basically im making a quiz on my main timeline ive got my questions and answers and on the last frame i want it to say how many answers the user got right. ive made a movie clip on this last frame. in the movie clip ive got 11 frames with the posible totals so frame one would be 0/10 frame 2 would be 1/10 etc what i want to do is when the user clicks the correct answer on the other frames i want flash to make the frames within the movie clip to go 1 step forward.

View 2 Replies







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