ActionScript 2.0 :: Changing Scene With Variable?

Jan 11, 2012

trying to make my first game using flash. I have done the main thing, setup a character which can be moved by the user to catch some falling balls. Every time a ball is caught, the score goes up by 1. To count and display the score, i have used a number variable called "caught" defined in the main timeline with initial value 0. The main timeline has only 1 frame and stopped by codes in the level "action". The "caught" variable is used in many movieclips in the scene and its value changes as the character catches the ball.

Now when the score is 10, i want to go to a new scene that shows a "congratulation you win" animation. For this, I have wrote the following code in the movieclip of the main character -

onClipEvent (enterFrame) {
if (_root.caught == 10) {
gotoAndPlay ("Scene 2",1);
}
}

But this does not work. The score goes upto 10 and then beyond 10.Is there anyway I can use the value of a number variable to determine when to play a particular scene?

View 4 Replies


Similar Posts:


ActionScript 1/2 :: Changing The Value Of A Variable In Movieclip From Scene?

Nov 13, 2009

i have a probleme changing the value of a variable in movieclip from my scene. i explain: I have combobox on my scene containing categories,and in the scene i load an xml file containing links to php files that work with the combobox.Also on the scene i have a movieclip "filmstrip", inside this movieclip on the first frame i have a script loading the php file selected in the scene. i use a load() function with a variable "theUrl" inside like this : T.load(theUrl);.In my scene i want to change the value of "theUrl" inside the movieClip filmstrip. I tried filmstrip.theUrl = url; But it doesnt work
 
the xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>[code]....

View 7 Replies

ActionScript 2.0 :: Changing From Scene 1 To Scene 2

Apr 24, 2008

im on scene 1, and i made a button which i want so when i click it, on release it will switch the whole flash movie to scene 2 but they doesn't seem to work.i want it to go to Scene 2, Layer 1, Frame 1. i renamed my scene2 layer 1 to 'fishwater' then i put this code on my button [code]

View 9 Replies

Changing From One Scene To Another Without Buttons

Oct 23, 2010

I'm creating a game in which you have to click/shoot the correct number as it passes by and when the scoreboard reaches 2 certain scores I need the scenes to change. I've managed to make it work for one scene where when the score hits 10 it changes to the next part of the game. However I also need to make it so that when the score hits -5 the scene changes to the "Final Score" scene where the player is taken if they lose. When I tried to use the same script I used the first time I just didn't know where to place it and it didn't work. How can I have 2 scripts working on the same timeline so that if the score reaches 10 the game proceeds but if it reaches -5 the game ends?

View 1 Replies

Actionscript 3.0 :: Changing Scene After Php Event?

May 15, 2011

I made a flash login in flash cs5 following this tutorial ( completed code at the end)and I was wondering how I can use the "this is the user bio" retrieved from the php to change to a different scene. What i am trying to do is have the scene change after a person logs in sucessfully

View 2 Replies

ActionScript 2.0 :: Changing Something In Unvisited Scene?

May 1, 2003

can I let a button change an mc in a scene that hasn't been visited yet?

View 4 Replies

Changing A Flash Scene When Highlighting A CSS Button?

Nov 4, 2009

I have a menu that is HTML/CSS. When I mouse over a menu item, I would a Flash header to change scenes accordingly.

Is this possible, and if so, how would I go about doing it?

I will be using Flash 8. I know how to animate, but I know nothing of ActionScripting. I'm a web designer, not a developer.

(I'm aware I could make the menu in Flash as well, but I personally don't care for having navigation set in a Flash .swf.)

View 3 Replies

ActionScript 3.0 :: Changing Scene When ComboBox Changed?

Jan 14, 2010

I'm a complete newbie to Flash and programming, so please forgive my lack of knowledge! I have been trying for a good couple of hours now to do what I'd think would be a simple task - change scene when the value in a comboBox is changed.This is the code I have:

stop();
dropdown.addEventListener(Event.CHANGE, changemade);
function changemade(event:Event):void {

[code].....

View 3 Replies

ActionScript 1/2 :: Object Staying After Changing Scene?

Oct 23, 2010

i am making this simple drag and drop game using flash cs3 using as2.i got 4 games and it has the same codes but different game type.. basically it uses drag and drop.here is the problem, when i finish the game, and press the back button to go to the selecting game scene, the last object dropped in the previous game stays and appears in the scene after that.
  
below is the as2 code i am using.
  
--- 
// global variablesvar tabbingON = false;var draggingON = false;var selectedPiece = 0;var totalPieces = 10;var total = 0;var mySound = new Sound();var origPos:Array = new Array();var justHit = false;var offset = 50;var counter = 0;
 // function callsinitGame();

[code]....

View 4 Replies

ActionScript 2.0 :: Object Staying After Changing Scene?

Oct 23, 2010

okey i am making this simple drag and drop game using flash cs3 using as2.

i got 4 games and it has the same codes but different game type.. basically it uses drag and drop.

here is the problem, when i finish the game, and press the back button to go to the selecting game scene, the last object dropped in the previous game stays and appears in the scene after that.

below is the as2 code i am using.

HTML Code:
// global variables
var tabbingON = false;
var draggingON = false;

[Code].....

View 0 Replies

ActionScript 2.0 :: Stop Sound While Changing Scene?

May 18, 2004

I have created an into to my flash site. I have put the intro in one scen and the main site in another. While the visitor watch the intro, he has the option to click "Skip intro", then he goes directly to the main site scen.In the intro scen I also have added a sound trackSo, I would like to find a way to stop the sound when the visitor click the "Skip intro" button and are linked to another scen. Right now the sound continue to the end of the sound track, even though I click to change scen. Does anyone know how to do this?

View 1 Replies

ActionScript 2.0 :: [FMX04] Changing Background For A Image With One Click On EVERY Scene?

Jan 8, 2006

I have set up ma flash project to have various scenes. One of these scenes is a page whereby when a user clicks on a button he/she can change the background image on every scene in my project.On each scene i have made a layer called 'background' and drawn a black rectangle which is the default background. This has been converted to a graphic using F8.What i'd like to be able to do is when the user clicks on the button he/she can change this default background to 1 of 4 photo's i have in my library.i have tried the code:

on (release)
{
colorchange = new Color("/rectangle");

[code]......

View 3 Replies

Flash :: Make A Button Navigate From Scene 1 To Scene 2 Without Displaying Both Scene Content In Scene2?

Jan 27, 2011

ive made a button in the scene 1 which i have managed to navigate to scene 2 but when i click the button it goes to scene 2 but displays everthing that is in scene 1 in scene 2, how can sort this out so upon the button click in scene 1 it goes to scene 2 and only display content in scene2.

[Code]...

View 1 Replies

ActionScript 2.0 :: Passing Parameters - Swf Should Open A Particular Scene Called 'Scene 2' Rather Than Scene 1

Sep 13, 2004

Check out this code:

[CODE]...

everything here is fine. It opens finely. But... i want to pass parameters where if i click a button in html page My.swf should open a particular scene called 'Scene 2' rather than scene 1. i tried

[CODE]...

View 2 Replies

ActionScript 3.0 :: Pass A Variable From One Scene To Another?

Apr 28, 2011

I'm making a call from one scene to another via a button, but I have two buttons calling the same scene, each for a different purpose, and I need to pass certain variables tied to each button to that called scene.

View 1 Replies

ActionScript 2.0 :: Pass In A Variable Into A New Scene?

Apr 16, 2010

how do i pass in a variable into a new scene? is it even possible

View 3 Replies

ActionScript 2.0 :: Go To Another Scene When Variable Health Reaches 0?

Feb 9, 2011

I have a game in which comets fall from the sky onto the player, and when they hit him helth gets decresed by 10 i want when health reaches 0(or less) for game to stop.

View 1 Replies

ActionScript 2.0 :: Global Variable Share Its Value In Other Scene As Well?

Aug 13, 2006

can global variable share its value in other scene as well?

View 2 Replies

ActionScript 2.0 :: Pass Variable From Scene To Movie Clips?

Jun 23, 2009

How do i pass variable from scene 1 to a movie clip? my movie clip name is over_mc. within the movie clips and scene 1 each have a textbox. i want to pass from the scene 1 textbox to the movie clip textbox. and display on the movie clip textbox.

View 0 Replies

ActionScript 1/2 :: Passing Variable From Scene To Movie Clip?

Mar 11, 2010

I have a problem with my actionscript. I can't pass the variable from scene 1 textbox to a movie clip textbox.My scene 1 textbox has a name of resultText. My movie clip is call over_mc which is on the symbols definition.the textbox for the movie clips is call finalResultText.here is my code:

_root.over_mc.finalResultText.text = resultText.text;

View 2 Replies

ActionScript 2.0 :: Changing Color Objects - Stay The Same Color That User Selected After Going To Another Scene?

Aug 5, 2004

i'm doing a school project of mine and i am having trouble doing the changing color objects. here is an axample of the script that i;m using:

on (rollOver) {
var colorful = new Color("_root.shapes");
colorful.setRGB(0x003366);
}

For this script it does change color, but how do i make it to stay the same color that user selected after going to another scene?

View 2 Replies

Flex :: Changing Image Size Independent Of Scene Size?

Apr 6, 2011

I have three images and I want change the images size based on the scene size (default size is 1024x768). After each image has completely loaded I call bindableUtils.setter to set width/height when scene size changes but I don't know how to make a pointer or something like that. I'm using a public var img, but it only works with the last complete image.

Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

[code].......

View 2 Replies

ActionScript 3.0 :: Flash - Calling Variable From Scene To Movie Clip?

Dec 9, 2011

tes is a movie clip.when i click zkanada button. movie clip will appear and play from frame 1.

Code:
//scene 1
var detail_temp:String=null;

[code].....

View 1 Replies

ActionScript 3.0 :: Changing Variable In Other Mc

May 3, 2010

I have a movieclip called 'Sitecontent'. Within this movieclip I'm using a variable to determine on which page my website is. The pages are seperate movieclips which I load throug addchild.When I load (for example) page 1, it start playing a openingAnimation which stops at a specific frame. After it stopped, I want to update my variable in the SiteContent mc. How to acces the variable from a other movieclip?

View 4 Replies

Variable Changing But Then Resetting

May 25, 2011

I'm very new to Flash, but I have been learning loads and getting some good results so far. Browsing these forums has been a massive help. However today I have hit a problem in what should be almost the simplest line of code I know how to write (variable = x), and could do with some advice. I have a simple program containing a button which will change a variable when pressed. There is also a text-box that will output that variable. However when I press the button, the variable will change, but then immediately revert to it's previous value.

[Code]...

View 3 Replies

ActionScript 2.0 :: Changing Of A Value Through A Variable?

Jun 16, 2010

I have used setProperty up till now, and it have met my needs needs so far.However, this one thing it cannot help with:

I have several different textfields all within different movieclips. I want to only change the content of only one of these textfields, however which textfield is changing all the time. Therefore the path of the textfield that needs changing has been put into a variable. Now I need to change the text of this textfield by using the variable(tempRevis1). i placed the path of the textfield within a variable:

_root.tempRevis1 = "_root.level1a_mc.AIRB237_mc.textMe1_txt";

Now this is what I hoped to have done:

setProperty(_root.tempRevis1, text, newTextValue);

View 0 Replies

ActionScript 2.0 :: Changing Value Of Variable In Mc From Another Swf?

Mar 29, 2004

I have one swf file that containes a mc using an easing function to move an arrow around.That mc has the instance named myruler. The arrow moves based on the value of a variable named "y". This swf also has a mc that I use as a container to load movies into.The movies that are loaded into the container mc have buttons that I would like to use to change the value of the variable "y" in the movie clip named myruler found in my base swf. Did that make sense? The code I'm trying to use on those buttons goes as follows:

on(release){
_root.myruler.y = 300;
}

The my ruler movie is in the swf that loads the swf with these buttons. So how do I point to that original swf.myruler.y?

View 2 Replies

ActionScript 2.0 :: Changing The Value Of My Variable?

Apr 29, 2003

I�m having some trouble with changing the value of my variable.I declare my variable in the first frame of the _root timeline.

currentSlide = 1;

When the _root movie plays it stops on a movie clip that contains four sub movie clips each is labelled sequentially( slide1, slide2, slide3 and slide4).I would like to know how to increase the value of my variable by 1 each time it progresses to the next slide. I can�t seem to get the variable currentSlide to change its value.

View 1 Replies

Changing The Value Of A Variable By Pressing Keys?

Jun 18, 2010

There is probably a better way to do what I'm trying to do, but I simply want to make a variable change its value when I press the arrows keys. For example if I wanted to cycle through weapons, if weapon=0 then the character is holding a certain weapon, then I press the down arrow key and weapon=1 and if weapon=1 the character is holding another weapon. And if I press up weapon=0 again so he's holding the first weapon again. And say there's 8 weapons, if weapon>8 then weapon=0 again so its a cycle. I tried arrow key functions and all they worked for was making a symbol move. I think I knew how to do this stuff in gamemker pretty well but Flash is very different.

View 2 Replies

ActionScript 2.0 :: Can't Add With A Constantly Changing Variable

Jul 10, 2010

I am making a game in flash, that uses several resources to build different buildings, that help you to gain resources, etc. I'm trying to make it so that the more "_global.food" you have, the faster your resources will go up. I have it so that the variable "_global.woodBoostMeter" goes up as fast as "_global.woodBoostSpeed" and when it reaches 500, it gives you 1 wood. I want it so that "_global.woodBoostSpeed" is modified by "_global.food" divided by whatever 200 is. (So that you will get resources faster for the more food you have)

Here's the code I'm using:

Quote:

_global.woodBoostMeter =0
_global.woodBoostSpeed = _global.food / 200
_global.woodBoostObtainRate =1

[Code]....

I think the problem seems to be with the "_global.woodBoostSpeed = _global.food / 200". it doesnt go up slow like it should, since "_global.food" starts out at like 200.

View 3 Replies







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