ActionScript 2.0 :: If Then Else Statement Load Movieclip?

Jan 29, 2011

I have built a calculator with a running total variable (stotal) this is working great. There are 30 buttons each having its own value each add or subtract from "stotal".The attached is a much scaled down and simplified version of the calculator. In this sample each button has a value of 200. If the user gets to 1000 or more I want to load an exiernal SWF "succes.swf" that notifies them they have reached 1000.

Here is the AS for one of the buttons. I know I need to wtite this as an "If then Else If" statement in order to get it to work but I am not having much luck;

q1a.onRelease = function(){
if (a1a==true){
a1a=false;
_root.stotal -=200;

[code]....

View 6 Replies


Similar Posts:


ActionScript 2.0 :: Create If Statement That Would Load Movie Clip After Different Movieclip Is Loaded

Apr 19, 2004

is there a way to create an if statement that would load a movie clip after a different movieclip is loaded.i have text_mc and scroll_mc. I dont want scroll_mc to load unless the content is loaded into the text_mc.I tryed to make an if statement sort of like a something used for a preloader but I must have been off just a bit because it was not working. I dont even know if it possible.

View 7 Replies

Flash :: "IF" Statement, Within A For Statement, To Control Movieclip Within Movieclip?

Dec 18, 2011

I have a movieclip on the screen called "mc_bg". Within this movieclip are 7 movieclips called "barrier1" through "barrier7".From main.as I want to be able to do this call:

for (var i: int = 1; i < 3; i++ ){
trace("got here")
trace(mc_bg["mc_barrier" + String(i)])

[code]....

View 1 Replies

ActionScript 2.0 :: If Statement From Within Movieclip

Feb 8, 2009

I am using Flash CS3 AS2. On my main timeline I have 3 buttons, each of which, when pressed go to the same frame in which a movieclip loads. However, when the movieclip gets to the end I want it to gotoAndPlay a different frame on the main timeline depending on which button had been pressed.

I'm guessing I need to use button instance names in combination with an if statement from within the movieclip but I'm not sure exactly.

So far I have tried

if (isPressed= "btn_latest_mar_cgn"){
_parent.gotoAndPlay("latest_cgn");
}

but something isn't quite right about that. Do I need to put something on my main timeline

View 7 Replies

ActionScript 3.0 :: If Statement To Sort And Load Files Type

Jun 23, 2009

basically i have an xml file that is loading image paths to my loader clip, i need to modify the code to load a pdf in a new window aswell. I'm working alonge the lines of using an if statement, but i do not know how to define it to distingiush the pdfs from the jpgs.

function changePic(pict:Number):void {
pictURL = EXTxml.picture[pict].@image;
trace(pictURL);
if (pictURL == //ends in .pdf)

[Code]....

View 1 Replies

ActionScript 3.0 :: Creating If / Then Statement - Load An External XML File

Apr 6, 2011

I'm using a movieclip to load an external XML file. In the XML I have a series of variables:

[Code]..

View 26 Replies

ActionScript 2.0 :: Create An If Statement That Would Load A Movie Clip?

Apr 19, 2004

is there a way to create an if statement that would load a movie clip after a different movieclip is loaded.

i have text_mc and scroll_mc. I dont want scroll_mc to load unless the content is loaded into the text_mc.

I tryed to make an if statement sort of like a something used for a preloader but I must have been off just a bit because it was not working. I dont even know if it possible.

View 7 Replies

ActionScript 3.0 :: Movieclip In Conditional Statement Of If?

Nov 28, 2009

In the code below how can I use the movieclip in the conditional statement? This is simplified, there is lots more going on but the basic issue is shown. I want to say if currently dragged mc is dot1_mc do the copyDragTo35 function

PHP Code: var item:MovieClip;
//add event listeners to all dots
kite_mc.dot1_mc.addEventListener(MouseEvent.MOUSE_DOWN, onItemDragStart);
kite_mc.dot2_mc.addEventListener(MouseEvent.MOUSE_DOWN, onItemDragStart);
function onItemDragStart( e:MouseEvent ):void {

[Code]...

View 2 Replies

ActionScript 3.0 :: If Statement And Random Movieclip?

Aug 3, 2010

I'm creating a small guessing game where on stage there are 6 squares, and the user has to click on a square, and see if it's the correct one (it should be a bit more exciting when it's finished!) The random answer is created using the math.random method and I'm using an array for the square movieclips. The problem I now have is with the IF/ELSE statements.

have a look at the following code, and the bit I need you boffins to look at is just after the if statement.

var myArray:Array = [mc_square01, mc_square02, mc_square03, mc_square04, mc_square05, mc_square06];
myArray[Math.floor(Math.random() * myArray.length)].addEventListener(MouseEvent.MOUSE_DOWN , chooseMe);

[Code].....

View 3 Replies

Flash :: Accessing Movieclips Within Movieclip Using For Statement?

Nov 1, 2011

I am trying to access movieclips within my movieclip using a for statement. To try and make this clear, here is how it looks at the moment:

sections = Holder movieclip where dtf_sections is placed, as well as other clips that are needed.

dtf_sections = Where all the title movieclips are placed that are going to be used when called. Placed in here to make it easier to move, within sections

title = Movieclip that contains the text that needs to be changed, within dtf_sections

Here is my code that works:

sections.dtf_sections.title1.dtf_title.text = "Section 1"

There are upto 10 titles within dtf_sections. So, what I thought would work is this:

for(var i:uint=1; i<10; i++){
sections.dtf_sections.["title"+String(i)].dtf_title.text = "Section" +(i)
}

The reason why they are within the movieclips is masking, and appearing at different times.

View 1 Replies

ActionScript 3.0 :: Movieclip Focus Not Working On If Statement

Jul 7, 2010

I have created menu which has roll over and out animations.What I am trying to achieve is to play the roll over animation when rolling over the menu, but stop the roll out animation IF the focus has been set on a specific movieclip.[cod]I am not sure what I am doing wrong, but if I trace the stage focus inside the if statement nothing happens, but it works if I trace it on else statement(gives null) which means that the if statement is bypassed and the else is played.

View 7 Replies

ActionScript 3.0 :: Movieclip Focus Not Working On If Statement?

Jul 6, 2010

I have created menu which has roll over and out animations. What I am trying to achieve is to play the roll over animation when rolling over the menu, but stop the roll out animation IF the focus has been set on a specific movieclip.

Here's my code:

Code:
function menuOut(e:MouseEvent):void
{
stage.focus == contentMc;

[Code]....

if I trace the stage focus inside the if statement nothing happens, but it works if I trace it on else statement(gives null) which means that the if statement is bypassed and the else is played.

View 1 Replies

ActionScript 3.0 :: Created Some Movieclip Buttons / Set A Statement To Disable It

Nov 18, 2009

I created some movieclip buttons, set a statement to disable it, but I can't enable them again when another button is selected how can i resolve this?[code]

View 4 Replies

ActionScript 2.0 :: Continue Statement - New SWF Is Not Loaded Into Movieclip After Reaching The End

Dec 18, 2005

[Code]...

What I'm trying to do is: When this button is pressed, whatever is in the current news_Clip movieclip goes to frame 71 and plays till it reaches the end of the outro animation which is frame 101. When it reaches frame 101, I want to load a new swf into news_Clip. Using the above code, the contents of news_Clip does its outro animation but the new SWF is not loaded into it after reaching the end. I've been screwing around with this for the past 7 hours and can't figure out what I'm not doing or doing wrong.

View 1 Replies

ActionScript 2.0 :: IF Statement - MovieClip Drag And Drop Into Certain Area

Mar 27, 2008

I am wondering if I can write an IF statement that is a movieclip is drag and drop into a certain area that an event occurs. Everything I try seems not to work any idea?

View 2 Replies

ActionScript 3.0 :: If Statement : Trigger If The Function Is Triggered By A Specific Movieclip?

Jan 10, 2010

I have a bunch of event listeners that refer to different movieclips but trigger the same function.I have an if statement within this function that I need to trigger if the function is triggered by a specific movieclip.

ActionScript Code:
//movieclip stuff....
addChild(backgroundPoint);
backgroundPoint.addEventListener(Event.ENTER_FRAME, animateBall);

[code]....

I know I could just create two separate functions but the code within the function (not shown here) is fairly long and I dont like repeating code.

View 2 Replies

ActionScript 2.0 :: First Requirement Of The If Statement When Type In The Proper Input And Go Straight To The Else Statement

May 14, 2009

Having a few problems with what I thought was a simple if statement. Here is the code:

[Code]...

I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.

View 7 Replies

ActionScript 1/2 :: Execute Code In Previous If Statement If Second If Statement Is Executed?

Aug 31, 2011

if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code

[Code]...
 
I dont want to copy the code from the first into the second and the first and second into the third.
 
My mind isn't working and there is probably an extremelly simple way to get this working.
 
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.

View 7 Replies

ActionScript 2.0 :: Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails?

Oct 10, 2008

The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {

[code]....

The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

View 1 Replies

ActionScript 2.0 :: If Statement Inside If Statement Won't Work

Mar 30, 2011

why this code won't work

[Code]...

I'm sure you can put if statements inside other if statements, seriously I can't figure it out

View 4 Replies

ActionScript 3.0 :: Another 'if' Statement Inside An 'if' Statement?

Sep 22, 2010

I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.

View 13 Replies

ActionScript 3.0 :: Use A For Statement To Create An If Statement

Jul 12, 2010

what I'm trying to do is create an else if argument for each object in an array based on a user set number

Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}

to which I want it to GENERATE THE FOLLOWING CODE:

Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}

the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?

View 4 Replies

ActionScript 2.0 :: Flash8 Variable Set-up - 'if' Statement To Run From Variable When Playhead Encounters MovieClip

Aug 21, 2009

I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.

[Code]..

View 2 Replies

Actionscript 3 :: If Statement Not Working - Loop Carrera(a Lenghthy Movieclip) From Frame 2 Back To Frame 1

Nov 25, 2011

This is an if stament on a frame on the root. I want to loop Carrera(a lenghthy movieclip) from frame 2 back to frame 1. (For testing purposes) This is the code:

[Code]...

View 3 Replies

ActionScript 2.0 :: Load Movieclip From Library Into Another Blank Movieclip On Stage?

Feb 8, 2006

how to load a movieclip into a blank movie clip all in the same movie?!

View 4 Replies

ActionScript 2.0 :: Random MovieClip Load In Another MovieClip, With Its Own Functions?

Dec 29, 2002

I've got 12 MovieClips, which all have specific functions in the movie. Those MC's will appear and dissappear after a few seconds. But what I want is, that those MC's have to appear at random .If all 12 MC's have appeared, the appearance has to be stopped. So for example MovieClip number 4 has to appear just once. So 12 MC's will appear, but everytime when the movie starts, the appearance has an other sequence.What is written above I want to place in an other MC. So there is one MC which 'load' 12 MC's within it

View 2 Replies

ActionScript 3.0 :: Write Another "if Statement" Inside Another If-else Statement?

Sep 22, 2010

I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...

example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}

View 3 Replies

ActionScript 2.0 :: Load Text Into A MovieClip Into Another Movieclip

Dec 28, 2010

I'd like to load text into my Flash movie to allow a simple 'Noticeboard' inside the flash movie. I've got it working with loadVariablesNum no probs. The trouble is I load the noticeboard into another movieclip. When this happens the text doesnt load even if I declare the variables, do _root etc.

View 5 Replies

ActionScript 2.0 :: [Flash8] Load Text Into A Dynamic Text Field And Load A Corresponding Picture Or Movieclip?

May 1, 2009

The desired affect is simple: I have a single button... with each click I want it to load text into a dynamic text field and load a corresponding picture or movieclip.There are only three unique text/image combinations- after its displayed the third, with the next click I want it to just start over. All the text functions perfectly with each click.

The problem is:I use "createEmptyMovieClip" then use the resulting clip as a loader clip.. With the first click I want a movieclip from the library to load, so I use the "attachMovie" method- it displays the first library fine.With the next click I want to load an external swf- so I call the "loadMovie" method of the loaderclip... The external swf loads just fine replacing the first library clip.The third clip is where I have problems... now I want to load another library item into the loaderclip... so I tried using the attachMovie method again but the external swf remains static... then with the next click, I discover the first library item no longer loads and the external swf remains still playing- it's like once it's been loaded into the loaderclip it cant be moved...

So I tried adding the "unloadMovie" method in the code for the third click.. it successfully removed the swf... but the next line of code immediately after the unload statement, doesn't work. The line calls the attachMovie method for the loaderclip... but the library item doesnt load... Oddly enough, with the next click, the first library item now does load as if everything's fine... It seems like you cant use the unloadMovie and attachMovie on the same executing code? if that makes any sense... the basic idea was that if I couldnt get the attachmovie method to replace the loaded external swf, then I would use the unload method to remove it, then have code immediately after, to then execute the attachMovie method... but it still doesnt load the library clip. and I know it's not a type-o, because when I comment out the loadMovie and unloadMovie statements, it loads both the library items perfectly ? The code is below

var increment:Number = 1;
var verbiage1:String = "Hello World1";
var verbiage2:String = "Hello World2";[code].............

View 2 Replies

ActionScript 2.0 :: Load A Movieclip In Another Movieclip?

Mar 14, 2005

I have a problem, i'm using this to load a movie into my main movie.

Code:
on (release) {
_root.bildspel.loadMovie("bildspel.swf");

[code].....

View 4 Replies







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