ActionScript 2.0 :: Jumping To Scenes Via Variables?
Sep 12, 2004how to jump to a scene that is identified by a variable?
I've tried:
New_Scene = "Scene 3"
gotoAndPlay ([New_Scene],1);
and all iterations thereof... No luck.
how to jump to a scene that is identified by a variable?
I've tried:
New_Scene = "Scene 3"
gotoAndPlay ([New_Scene],1);
and all iterations thereof... No luck.
How can you switch between scenes by f.e. pressing a button I thought of using loadMovie but then I have several .swf files and I'd like everything in 1 swf file
View 7 Repliesare variables global through scenes? I am working on a game show w/multiple scenes and i need a variable that i used in a previous one, but i dont know if it carries through.
View 4 Repliesif I have two scenes and on scene 1 I have some code with variables and event listeners in it and I copy that code into Scene 2. When I test the movie I get a duplicate function definition error because the variables/event listeners on both scene 1 and 2 have the same names. To fix this I could just change the names of the variables and event listeners in scene 2 to a different name but what if I have say 10 or 20 scenes then I would need to change the names of all of them on every frame and I don't want to do that.Is there a way of using the same variables/event listeners on different scenes without having to rename them and without getting the duplicate function definition error.
View 21 Replieswhenever I set my sound to stream and continue to make a movie with multiple scenes. The audio and video get disgustingly out of sync sometimes even off by 30 seconds. I just started an animation its only 10 seconds long with two scenes and the AV is already off by about 5 seconds. Ive worked around this by avoiding scenes altogether but i really don't want to have another 5000 frame scene. I discovered this problem in Flash MX and Im quite annoyed that it still has't been fixed 3 years later!
View 1 RepliesI have an interactive story divided into scenes. At the end of each scene a button appears. This occurs on a frame on the timeline.
There are two different buttons that might appear based on whether a prior scene has been viewed or not.
For example, there are Scene_1 and Scene_2. At the end of Scene_2 one of two buttons will appear. The buttons will be either "Go see Scene_1" or "Return to Main Menu".
If the user has already seen Scene_1, Flash will know that and automatically go to the frame in Scene_2 that contains the button "Return to Main Menu".
Conversely, if the user has not seen Scene_1, Flash will know and automatically go to the frame in Scene_2 that contains the button "Go see Scene_1".
I imagine there would be an action frame at the end of Scene_2 that will contain the as2 code to enable this action.
Perhaps something like, but probably not at all like the following:
if ("Scene_1", last frame == true){gotoAndPlay("frame#");}else{gotoAndPlay("frame#");}
I am working with a project that has many scenes. Each scene has a movie clip attached to it. The first scene is simple...just a couple of buttons and that is it. My worry is that when I add all of the videos that correspond with each button and publish the SWF will be a huge file. THE QUESTION: Does flash load ALL scenes of a movie or does it load the first scene and then load the other scenes when the user needs to view them?
My ultimate goal is to just have the first scene load and then when the user clicks on the buttons contained within that scene that only upon release does the corresponding scene load. Maybe I am doing this completely wrong and should look at doing it another way.
I'm adapting this iTunes coverflow style gallery for my own purpose [URL] Basically, the locations of the artwork and the URLs for when you click on a picture are stored in an XML file. Is it possible to adapt the AS or XML so that instead of opening a URL, clicking on a cover jumps to a particular frame on the timeline? Basically what I want to do is have the first and last items acting as previous and next buttons to go to a different frame on the timeline. I guess what i need to do is get the actionscript to do whatever is within and replacing that with the action I want it to perform?
View 2 RepliesI have this rather cool code for a _mc on a slope. The only problem I am having is making the sprite.mc change states/animation when the sprite.mc is jumping.here's the code I have:
onClipEvent(load){
speed = 5;
gravity = 0;
r = _height/2; //radius
[code]....
I have a piece of code in AS3 but it doesn't work with AS2:
stop();
function login(event:MouseEvent):void
{
this.gotoAndPlay("first_page");
[Code]....
But I still have a problem. I have stops in each key frame but when I play the movie it shows directly the first_page section skipping all other frames before it.
I have made 2 scenes. I am trying to jump 1scene to next scene you can find source file from here
scene1 is LoderScreen
scene2 is GameScreen and frame label is "start"
I did this gotoAndPlay("start","GameScreen")
But it is showing error/
Original FLA file [URL]
I am wanting to fade out of a frame and then fade into another, and the way i was thinking of doing this was to code a tween to alpha 0 and then use the code:
home_btn.addEventListener(MouseEvent.CLICK, startMovieHome);
function startMovieHome(e:MouseEvent):void
{
[Code]....
I dont know how to ask it to tween and then go to the label "home" once the tween is complete..
Okay so im making a game for a class...im using flash player 8....i need an actionscript code for looping a background that i have. i need an actionscript for having my character jump..
View 1 Repliesok so i know you can use gotoAndPlay to jump to a different frame but how do you jump to a curtain line of code in that frame
View 7 RepliesWhat I created was just a test but I can't seem to get it working. What I did was create a very small rectangle at frame 1. Created a tween and then at frame 100 made it a very large rectangle.
Then in my code I wanted the user to MOUSE_OVER something and the rectangle to ease to the length it was at frame 30. However I keep getting this error message:
ArgumentError: Error #2109: Frame label frame 30 not found in scene Scene 1.
at flash.display::MovieClip/gotoAndStop()
at Untitled_fla::MainTimeline/test()
Here is my code:
[CODE]
stop();
circle_mc.addEventListener(MouseEvent.MOUSE_OVER, test, false, 0, true);
circle_mc.addEventListener(MouseEvent.MOUSE_OUT, test2, false, 0, true);
[Code].....
I want the button in my flash movie to jump to seperate html page called bios.html and go down to the anchor "kbrown".
I tried putting this code on the button. It went to the correct page but didn't scroll down to the anchor
Code:
on (release) {
getURL("bios.html/#kbrown", "_self");
}
[Code].....
I need to know what actionscript(2.0) to use in order to make my movieclip(player) jump when i press space and switch to another movieclip(player_jump) and then switch back to "player" when it reaches the ground. otherwise i won't be able to get my skateboarder to ollie(just so you know what kind of game it's going to be). my movieclips(sorry about the watermarks...)
View 14 RepliesI have a maths-based movie on which a number of points are allocated depending on the answers given to a series of multiple choice questions.
At the end of it, a person will score somewhere between 1 and 10 points depending on the answers they gave.
I have got to the stage where the system keeps track of the cumulative score, and at the conclusion, I have a text field on stage, which has an instance name of "results". When the person enters the frame, the results field displays the total number of points scored.
That is ok, but what I actually would like to happen is that the movie jumps to a different frame based on that figure, so that if they score 2, it would take them to the frame labelled "two" and if they score 9, it takes them to frame "nine"
Is there a way of effectively saying:
On frame enter
if results.text = 1 go to "one";
if results.text = 2 go to "two"
etc etc
I'm guessing that I need to use the:
_root.onEnterFrame = function(){
};
how to describe the bit in the middle...?
I made this Flash banner few months ago for this website [URL] When I play the banner on my computer everything is fine but when is on the web you can see the saccade (the image is jumping it is not smooth)
View 2 RepliesI'm having trouble getting my character to fire. it seems to fire when he jumps, but not while standing. I have attached my code to the zip file below:This is the code I used:
onClipEvent (load) {
var gravity:Number = 0;
var speed:Number = 5;
[code]....
i'm making a photo gallery in flash AS3. I have two buttons, prev and next, what i want is when you are at the last image end press next, you jump to the first image. I have tried to google it and searched for an answer, but cant find anything. This is my code so far.
picture.stop();
rbutton.addEventListener(MouseEvent.CLICK,
clicknext);
lbutton.addEventListener(MouseEvent.CLICK,
clickprev);
[code]...
In an alphabetically sorted array, I want to jump from one letter to another. So, when Im with a word beginning with a, I want to jump to the next item beginning with etc
Ive set up this simple script, which simply look at the first character of the current item, then loop in the (sorted) array until it finds a different first character It works very well hen descending! But when ascending, the script sees that there is character change but this is not the first item beginning with that letterbut the last one (since we are coming from bottom to top)
And of course I would like the script to give me the very first item beginning with a new letter.
(So, to summarize, I want to browse an array alphabetically, up & down, so that each time I press on the UP arrow key, I go up in the alphabet.and when I press the DOWN arrow key, I go down in the alphabet)
[Code]....
This isn't working right. From what I understand, it should, but it doesn't.
Code:
on(release){
var targetFrame = this._currentframe;
if(targetFrame == 10){
[Code]....
The trace returns "1" every time I press the button.
I'm learning AS3 as I modernize the VCR controls for our e-learning topics. The way we used to do it was load the wav into the timeline and keyframe to the audio. We have a little tracker bar you can click on to jump around, a tracker icon you can drag, play/pause and FF/RW buttons. In AS2, since the wav was in the timeline, I just had to worry about frame numbers.
It seems like the modern way to do it is to load the audio as an MP3 externally. How accurate will this be as far as sync'ing the audio to the animation when using the tracker bar and jumping around? I'll basically be mathematically slicing the bar graphic into pieces and using that to tell the animation what frame to start on, and converting that to a time for the audio to start.
I really want to smooth the animation a little bit more.i want the animation to look smooth, no jumping or stopping, want continuous
View 1 RepliesI have a video (that im calling from my harddrive) that i would love to play once through,then jump onto the next frame (where theres another video that continues from the end of the first). Why can i not use the following code to jump?
on(complete){
gotoAndStop(5);
}
I am trying to make a button jump to a label in the main timeline from within a movieclip but I dont think i have the syntax etc correct. I'm getting "access of undefined property _root" when I run the following code. Any ideas what I'm doing wrong here? heres the code..
menuButton_IN.pHome_IN.addEventListener(MouseEvent .MOUSE_DOWN, onPressHandler);
function onPressHandler(myEvent:MouseEvent){
_root.gotoAndPlay ("home");
[code]......
This is the predicament Im in. I have 3 files:
Launch.exe
video.swf
pause.swf
In the launch.exe, I have a loadmovie command which loads the external file video.swf. When the video is loaded, I want the viewer to be able to hit the SPACEBAR at any time which will result in pausing the video (pause.swf appears on screen) and after 3 seconds unloads the video.swf file and jumps to a frame label on the Launch.exe timeline. The code below is what I have at the moment but it doesn't work.
[Code]....
I tried to get this right but it just won't work for me. It's probably something very simple. I have a video in a movieclip on my timeline. On the first frame, I have the stop(); command. I want to be able to hit the SPACEBAR: which results in pausing the movieclip and jumping to frame 2 on the timeline.
View 8 RepliesI have an external swf (is is an intro, nade in aftereffects)..and it loads in the main timeline of the site with a preloader. Everything is ok, but, when the intro in done plating. It stops and I want do see de site. I mean from the last frame of the external swf, I want to jump to the second frame of the main timeline.
Here is the script:
stop();
var req:URLRequest = new URLRequest("intro.swf");
var loader:Loader = new Loader();
function fileLoaded(event:Event):void{
addChild(loader);
[Code] .....