If/else Statement With Variables:
I have 3 variables within this if/else statement that i want to do 2 different things if it doesn't equal the value. When this play button is released then do the following: 2 of the values are called (P1_paddle_ready & P2_paddle_ready). if the value of these 2 variables equal 1, then do the following: _root.gotoAndPlay("start_game"); if they dont (else statement) do the following: _root.audio.gotoAndPlay("whistle");_root.audio.gotoAndPlay("compete_your_selection")d ifficulty_screen._visible = true;paddle_screen._visible = false;controller_screen._visible = true;bg_screen._visible = true;bg_load._visible = false;paddle_load._visible = true;controller_load._visible = false;difficulty_load._visible = false; the thing that is making this code complicated, which is getting me stuck is if that equals 1 paddle ready variable now check the other variable difficulty_ready. if difficulty ready equals 1, then do the following:B]_root.gotoAndPlay("start_game");[/b] if they dont (else statement) do the following: _root.audio.gotoAndPlay("whistle");_root.audio.gotoAndPlay("compete_your_selection")difficulty_screen._visible = false;paddle_screen._visible = true;controller_screen._visible = true;bg_screen._visible = true;bg_load._visible = false;paddle_load._visible = false;controller_load._visible = false;difficulty_load._visible = true; So how can i get these both to work when this play button is released??? Any help would be great.CheersPeter.D
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-31-2004, 11:21 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding Variables To Variables In An If Statement
I have a variable named 'Position' which is collecting numbers from various positions, and changeing = 1,2,3 etc.
I want to add 'Position' with its value to other variables:
Sentence, SentenceAnswer ets as seen below.
I have tried as you can see, but it does not work, can anybofy help.
function CheckAnswer(){
if (Sentence+'Position'==SentenceAnswer+'Position'){
_root.Feedback+'Position'=Sentence+'Position'+Corr ect;
}
Cheers
lee
Set Variables & If Statement
ok- here is a simple <so i thought> movie that i am working on.
there are three buttons on the stage.
there are three mc's on the stage.
each mc is a pic that fades in to full alpha and then has a stop action.
my problem is with the scripting... i want to make it so that if one pic is already faded in fully, it fades out before the next one comes in...
i basically have it working, but if you click around the buttons more that once, it locks...
i think i need some sort of statement that clears my variables so the flash player doesn't get confused...
here is the .fla so you can see what im talking about.
http://www.kupah.com/work/fade_trial.fla
thank you very much for helping...
-kupah
If Statement And Variables
Hello everyone. I have a movie with approx. 270 variables. It's an order form and the text fields, which are the variables for users to input quantity. I have it working great with all the text fields adding up. I have to do a preview page though where the user can see what they have ordered. Currently I can make it work by using an if statment that checks to see if the text field was filled in and if so display certain text. the problem is I have 270 variables. I think it would be pretty bad if I have 270 text boxes on the page waiting to display text if another text filed was filled in. So would anyone happen to know a way to do this? This is the code I am currently using:
if (!variablename.length){
textfield1=you ordered this
quantity= how many you ordered
How can I set this up where there would be a dynamic multiline box that would display everything ordered with quantity? Any help is deeply and seriously appreciated.
Using Variables Within A Statement
Hello,
I have the following code:
if (tripOne_background_txt.text == "") {
tripOne_background_txt.text = "test"
}
I want to replace the text tripOne with a global variable:
_global.myTrip = "tripOne"
and use this global variable in the first code to look something like this:
if (_global.myTrip + _background_txt.text == "") {
_global.myTrip + _background_txt.text = "test"
}
Any ideas how I can use a global variable within an if statement and when assigning values?
Rob
If/else Statement With Variables:
I have 3 variables within this if/else statement that i want to do 2 different things if it doesn't equal the value to jump to the next frame.
2 of the values are called (P1_paddle_ready & P2_paddle_ready). if the value of these 2 variables equal 1, then do the following:
_root.gotoAndPlay("start_game");
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")
difficulty_screen._visible = true;
paddle_screen._visible = false;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = true;
controller_load._visible = false;
difficulty_load._visible = false;
If/else Statement With Variables:
I have 3 variables within this if/else statement that i want to do 2 different things if it doesn't equal the value. When this play button is released then do the following:
2 of the values are called (P1_paddle_ready & P2_paddle_ready). if the value of these 2 variables equal 1, then do the following:
_root.gotoAndPlay("start_game");
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")d ifficulty_screen._visible = true;
paddle_screen._visible = false;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = true;
controller_load._visible = false;
difficulty_load._visible = false;
the thing that is making this code complicated, which is getting me stuck is if that equals 1 paddle ready variable now check the other variable difficulty_ready.
if difficulty ready equals 1, then do the following:
B]_root.gotoAndPlay("start_game");[/b]
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")
difficulty_screen._visible = false;
paddle_screen._visible = true;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = false;
controller_load._visible = false;
difficulty_load._visible = true;
So how can i get these both to work when this play button is released???
Any help would be great.
Cheers
Peter.D
If Statement With Variables
I'm trying to display a message in a dynamic text box if the user types in a specific name in a search box, based upon an array. If the user types in "choice 3" for example, I want my "message" text box to display a message about the user's choice.
I got some help earlier today and was told that "my conditional statement is trying to compare the Array with a String. This won't work, I need to compare the string inside the array with my value."
My code's below, but I can't figure out where I need to put my 'if' statement. Any ideas?
import fl.data.DataProvider;
import com.yahoo.astra.fl.controls.AutoComplete;
var choice:Array = [{label:"choice 1"}, {label:"choice 2"}, {label:"choice 3"}, {label:"choice 4"}, {label:"choice 5"}, {label:"choice 6"}, {label:"choice 7"}, {label:"choice 8"}, {label:"choice 9"}, {label:"choice 10"}, {label:"choice 11"}, {label:"choice 12"}, {label:"choice 13"}];
autoComplete.dataProvider = new DataProvider(choice);
if( choice[0].label == "choice 3" )
{
message.text = "Hello Kitty";
}
If Statement With Many Variables
Is it possible to have an if statement verify the value of a variable to a range of values? like:
if (myVar) = (1, 21, 41, 61, 81, 101)
goto...
Thanks
If/else Statement With Variables:
I have 3 variables within this if/else statement that i want to do 2 different things if it doesn't equal the value. When this play button is released then do the following:
2 of the values are called (P1_paddle_ready & P2_paddle_ready). if the value of these 2 variables equal 1, then do the following:
_root.gotoAndPlay("start_game");
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")d ifficulty_screen._visible = true;
paddle_screen._visible = false;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = true;
controller_load._visible = false;
difficulty_load._visible = false;
the thing that is making this code complicated, which is getting me stuck is if that equals 1 paddle ready variable now check the other variable difficulty_ready.
if difficulty ready equals 1, then do the following:
B]_root.gotoAndPlay("start_game");[/b]
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")
difficulty_screen._visible = false;
paddle_screen._visible = true;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = false;
controller_load._visible = false;
difficulty_load._visible = true;
So how can i get these both to work when this play button is released???
Any help would be great.
Cheers
Peter.D
If-then Statement & Variables
Hi, this is my first time using variables and If then statements, and I'm a bit stuck. What I want to achieve is to have a button, but if it has been clicked, I do not want it to be useful until another button has been clicked. The website starts in the news section so I did this
currentlyLoaded = "news"; <-- Global variable
Then I set it up so that each time a button is pressed, it's section becomes the "currentlyLoaded". And finally I put in this if - then statement.
if(currentlyLoaded != "news"){
_root.clearPage();
}
I have traced my variable (currentlyLoaded) and I know it is news, but for some reason my if-then statement plays whether it IS news or it is NOT. Any help would be greatly appreciated! Thanks
If/else Statement With Variables:
I have 3 variables within this if/else statement that i want to do 2 different things if it doesn't equal the value. When this play button is released then do the following:
2 of the values are called (P1_paddle_ready & P2_paddle_ready). if the value of these 2 variables equal 1, then do the following:
_root.gotoAndPlay("start_game");
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")d ifficulty_screen._visible = true;
paddle_screen._visible = false;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = true;
controller_load._visible = false;
difficulty_load._visible = false;
the thing that is making this code complicated, which is getting me stuck is if that equals 1 paddle ready variable now check the other variable difficulty_ready.
if difficulty ready equals 1, then do the following:
B]_root.gotoAndPlay("start_game");[/b]
if they dont (else statement) do the following:
_root.audio.gotoAndPlay("whistle");
_root.audio.gotoAndPlay("compete_your_selection")
difficulty_screen._visible = false;
paddle_screen._visible = true;
controller_screen._visible = true;
bg_screen._visible = true;
bg_load._visible = false;
paddle_load._visible = false;
controller_load._visible = false;
difficulty_load._visible = true;
So how can i get these both to work when this play button is released???
Any help would be great.
Cheers
Peter.D
Using Variables Within An If Statement
lo people...
I had this bit of code on a MC which works fine:
this.port_2_1._visible = true;
this.port_2_2._visible = false;
this.port_2_3._visible = false;
I then wanted to set the visible states of the port_2_* mc's using a variable stored in _level0 so I did this:
onClipEvent (enterFrame) {
if (_level0.portvar = "ia") {
this.port_2_1._visible = false;
this.port_2_2._visible = false;
this.port_2_3._visible = true;
} else {
this.port_2_1._visible = true;
this.port_2_2._visible = false;
this.port_2_3._visible = false;
}
}
...and, guess what?, it didn't work
Now when I click on the button that sets portvar = "ia"; it sets the variable (I've checked through the debugger) but all the port_2_* MCs are now visible.
What am I doing wrong?
p.s. I consider myself an AS n00b btw
Using The If Statement With Imported Variables
Ok here goes...
I am successfully importing a variable via a php script. I know it works cause I can display it in a dynamic text box and it shows up as a variable when I debug the movie. However, I am unable to do anything more than display the variable in the text box. I can't seem to assign it to another variable in the movie, nor can I apply any conditions to the imported variables.
Here is my actionscript placed in the _root of the main movie on frame one:
stop();
loadVariables("echo.php", "_root");
wtf = loadedvar1;
if (loadedvar1 == "gogogo") {
gotoAndStop(2);
}
When I run it in debug it tells me the following variables are in the level0 section:
loadedvar1 = "gogogo"
wtf = undefined
The really annoying thing is that "gogogo" IS displayed in the dynamic text box that I have assigned the variable of loadedvar1 to.
If you know why I can display this variable content but not do anything else with it please, please put me out of misery! I'm going mad here! tks =p
#include Statement And Variables
hello,
while sitting here daydreaming (i don't have access to flash at the moment) i am wondering is it possible to use variable in the #include statement? instead of writing
Code:
#include "../classes/myScript.as"
to write something like
Code:
#include "../classes/" + myVariable + ".as"
then you could keep folks from stealing your movie...maybe
i dunno just a thought
- mb
If Statement Checking 4 Variables
For some reason, if any of the other variables are set at yes, and the bmi is still higher than 25.5 it will say diabetes no matter what. It looks like its only checking that one variable and nothing else...can someone please help, here is my code:
if ((_global.surgery="no") && (_global.hemophilia="no") && (_global.anemia="no") && (_global.bmi>="25.5")) {
_root.tests_one_txt = "Diabetes";
} else {
_root.tests_one_txt = "";
}
[as1] Switch Statement Variables
how do I change case 3 enemy to false from another function, ie. hitTesting?
code:
attachEnemy = function(m) {
switch (m) {
case 1: enemy = true; enemyPos[1][4];
case 2: enemy = false;
case 3: enemy = true; enemyPos[6][7];
}
//...then attach the enemy and so on and so forth.
}
Thanks.
If Statement Ant Text Variables
Im loading a variable "fps" into my file, and in the on(release) properties of a button i have this code:
if (fps = "5") {
_root.framecount.GoToandPlay(20);
}
if (fps = "8") {
_root.framecount.GoToandPlay(25);
}
if (fps = "10") {
_root.framecount.GoToandPlay(30);
}
Now it goes to frame 30, althoug the variable loaded (fps) is 8 and it should go to 25
Anyone got a clue ?
Variables And If Statement Question
hi,
i have a series of MC's, they all have nested buttons.
now what i need is some code that says that when the button is clicked on it changes the variable to true.
then i need an if statement which says if all of these variables are true then play a certain MC.
i tried like this.
in MC
code: onClipEvent (load) {
var zvisi = false;
}
then in the nested button i put:
code: on (release) {
var zvisi=true
my if statement was as follows;
code: if (var zvisi == true) {
endMC.play(1);
}
and it doesnt work, can someone plese help?
thanx in advance...
?variables? ?conditional Statement? Help?
Now I am in variables...
have no clue...
that first part was hard enough.
what is the code to make the buttons go frome frame to frame with variables?
if (variable < 30
variable = variable + 1;
face.nextFrame();
}
Is that it? Do I just put that in once? or am i missing something?
Variables And If Statement Problems
Hi,
i'm having some trouble with variables. I'm currently working on a portfolio website which has a working menu at the top. But i'd like to put some invisible buttons either side of the center section to allow navigation as well.
I'm using a variable to keep track of the current section in view (in the center) but this is not working in the wip button (orange). 'Trace' is showing that the variable is being read correctly but the movement of the sections doesnt work. The 'portfolio' section is moved from right to center everytime....when it should rotate the sections like a carousel.
It seems that the 'if statements' are being totally ignored...
Below is a simplified version of the coding used (some of the tween actions have been removed)
Quote:
on (release) {
import mx.transitions.Tween;
import mx.transitions.easing.*;
if (currentSection == "Portfolio") {
//Move and resize Bio section from right to center
var alphaBioTween:Tween = new Tween (Bio_mc,"_alpha",None.easeInOut,30,100,1,true);
var xscaleBioTween:Tween = new Tween (Bio_mc,"_xscale",None.easeInOut,30,100,1,true);
var yscaleBioTween:Tween = new Tween (Bio_mc,"_yscale",None.easeInOut,30,100,1,true);
var xBioTween:Tween = new Tween (Bio_mc,"_x",None.easeInOut,720,-80,1,true);
var yBioween:Tween = new Tween (Bio_mc,"_y",None.easeInOut,220,40,1,true);
currentSection = "Bio";
}
if (currentSection == "Services") {
//Move and resize Bio section from left to right
var alphaBioTween:Tween = new Tween (Bio_mc,"_alpha",None.easeInOut,30,30,1,true);
var xscaleBio:Tween = new Tween (Bio_mc,"_xscale",None.easeInOut,30,30,1,true);
var yscaleBio:Tween = new Tween (Bio_mc,"_yscale",None.easeInOut,30,30,1,true);
var xBioTween:Tween = new Tween (Bio_mc,"_x",None.easeInOut,-320,720,1,true);
var yBioTween:Tween = new Tween (Bio_mc,"_y",None.easeInOut,220,220,1,true);
currentSection = "Portfolio";
}
if (currentSection == "Bio") {
//Move and resize Bio section from left to right
var alphaBioTween:Tween = new Tween (Bio_mc,"_alpha",None.easeInOut,30,30,1,true);
var xscaleBio:Tween = new Tween (Bio_mc,"_xscale",None.easeInOut,30,30,1,true);
var yscaleBio:Tween = new Tween (Bio_mc,"_yscale",None.easeInOut,30,30,1,true);
var xBioTween:Tween = new Tween (Bio_mc,"_x",None.easeInOut,-320,720,1,true);
var yBioTween:Tween = new Tween (Bio_mc,"_y",None.easeInOut,220,220,1,true);
currentSection = "Services";
}
}
Any thoughts or advice?
thanks,
Greg.
Declaring Variables Through An If Statement
i'm kind of an actionscript noob
does this make any sense?
i'm trying to define a variable based on whether or not another variable is null.
(i created this example for the sake of clarity)
Code:
var nothing:String = null;
var apples:String = "Red";
var bananas:String = "Yellow";
var blueberries:String = "Blue";
if (nothing == null) {
var fruitSalad:String = "colorless";
} else {
var fruitSalad:String = apples + bananas + blueberries;
}
trace(fruitSalad);
i keep getting this as an error:
1151: A conflict exists with definition fruitSalad in namespace internal.
any help would rock
thanks guys | idriss
If() Statement Not Working With Variables
i have a form on my site that was using instance names to send the data to a php file. that was not working for me so i had to change them to variables. when i did this the if statement that goes to the error message if something is left blank stopped working.
so i have tryed to use != and changed the if and else, that didnt do anything. i also tryed to use undefined and that didnt do anything.
Code:
if (theEmail.text == "") {
gotoAndStop("error");
}else {
i was using code like that. i tryed with null as well. when i used null it would go to the error every time and when i use "" it sends every time. even if there is no informaton
If Statement To Check Multiple Variables?
What is the proper usage of the 'if statement' if I need to check if several variables are being called ???
I am using this: but it isn't recognizing the difference between the different variables. (it brings all the MC's to frame 2)
if (section == scroll01) {
_root.WindowSafetyGI.scroller01.gotoAndStop(2);
}
if (section == scroll02) {
_root.WindowSafetyGI.scroller02.gotoAndStop(2);
}
Thanks in advance for the help.
Steve.
[help] Defining Multiple Variables In An 'if' Statement
OK, so I'm trying to get an 'if' statement that says, on a mouse rollover, check to see if variable a, b, c, and d = a value. That's all I need. I just need to see how you nest multiple variables using an 'if' statement.
Code:
on(rollOver) {
if...
}
[MX04] Passing Variables & If Statement
Ave,
I have three buttons on stage. Each button has an Actionscript like this:
on(press) {
book2load = "book1";
_root.gotoAndPlay(266);
}
On a further frame, i have this:
stop();
if(book2load=="book1") {
loadMovie("book1_preloader.swf",_root.dropZone);
}
else if(book2load=="book2") {
loadMovie("book2_preloader.swf",_root.dropZone);
}
else if(book2load=="book3") {
loadMovie("book3_preloader.swf",_root.dropZone);
}
Basically what i want is to pass a variable (book2load), depending on which button was clicked, and whatever variable is recieved, the corresponding movie should be loaded.
But it's not working! I'm obviously doing something wrong in either passing the variable or reading or the if statement. Not sure where.
Any help?
***************
Well this didn't last long. Solved the problem. Problem was with variable declaration. Decalred it as:
_global.book2load = "book1";
And now everything is working fine.
Syntax Error In If Statement Using Variables
Hi guys.
I've got a problem with a script.
This is an example from part of the script. The problem is that the script "_root.main.gotoAndPlay("shut");" doesn't execute, even though I've just defined that _global.moviename is equal to "front";
Code:
_global.moviename = "front";
this.btn1.onRelease = function() {
if (_global.moviename != "second") {
_global.moviename = "second";
if (_global.moviename == "front") {
_root.main.gotoAndPlay("shut");
} else {
_root.container.gotoAndPlay("close");
}
}
};
Can anyone give me a clue to, what's wrong with this?
Thanks a lot.
Drag N Drop, If Statement, Variables Failure
Hi,
I'm in the middle of making a drag and drop exercise for a safety module, while I can only do basic actionscripting, I am having real trouble getting this hittest to work. I have 2 drag items, once dropped onto the right hotspots, when you click submit the textbox should say passed. But if you didn't put them on the hotspots or in the wrong order ,it should say failed.
I've been trying for the longest time and cannot get it to work. For some reason when you click submit, without even touching the drag items, it still says Passed.
The exercise doesn't look pretty atm, as I am trying to understand the variables, but if someone could explain to me what I am doing wrong, I would greatly appreciate it.
Thanks
http://www.mechapets.com/hittest-trial.fla
Question About Variables In Left Side Of Statement
Ok, I have 5 movie clips (DEAL1 through DEAL5), each containing a loader box (ImageLoader1 through 5) which loads an image in each. These 5 images can then be flipped through like a slideshow. All that is good and works fine, pulling the filenames from an XML file:
Code:
IMAGE1=allData[0].attributes.ImageFilename;
// That line is repeated for IMAGE2 thru IMAGE5
But then I wanted the slideshow to start on a random frame, which I did with this on frame 1:
Code:
// Start on a random frame
TheNumber = Number(random(6))+1;
if (TheNumber == 1)
{
gotoAndStop(2)
}
else { gotoAndStop(_root.TheNumber) };
So in order to get the first image to load, I need to match the random starting frame number with the MC number (DEAL#), loader (ImageLoader#), and filename from the XML file (IMAGE#.jpg)... so I wanted to transform this:
Code:
DEAL1.ImageLoader1.contentPath = "DealImages/"+IMAGE1+".jpg";
DEAL2.ImageLoader2.contentPath = "DealImages/"+IMAGE2+".jpg";
DEAL3.ImageLoader3.contentPath = "DealImages/"+IMAGE3+".jpg";
DEAL4.ImageLoader4.contentPath = "DealImages/"+IMAGE4+".jpg";
DEAL5.ImageLoader5.contentPath = "DealImages/"+IMAGE5+".jpg";
into something like this:
Code:
ImgNum = TheNumber - 1;
var DealNum = "DEAL"+ImgNum;
var LoaderNum = "ImageLoader"+ImgNum;
DealNum.LoaderNum.contentPath = "DealImages/IMAGE"+ImgNum+".jpg";
... only this doesn't work. I can trace ImgNum, DealNum, and LoaderNum just fine... but put into the LEFT SIDE of the statement, DealNum.LoaderNum.contentPath is undefined. Is there a way to set those to work? Thanks!
Problem Loading Variables And Comparing Loaded Var With If Statement
I am loading variable strings from a textfile using:
loadVariables ("Map/lotes.txt", loteData);
The text file has the strings in the following format:
&lote1=H506,01,El Gaucho,Restaurante
Then I am splitting the string using:
lote = loteData.split(",");
lote[0] should be H506
lote[1] should be 01
lote[2] should be El Gaucho
lote[3] should be Restaurante
I have already have instances loaded in the movie named the same as a concatanation of lote[0] and lote[1] nested inside another clip named the same as lote[0] all inside other clips the path is:
_root.Map.Map[lote[0]][lote[0]+[lote[1]]]
I am atatching a variable loteType to the instance :
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType = lote[3];
But when I want to check if the variable matches a test string I do not get a match:
if (_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType == "Restaurante") {
trace("This is a Restaurant");}
Whats wrong? Is it that the variable is not declared as a character string? I cant figure it out. I also am having
Attach Code
// Import Data
this.createEmptyMovieClip("loteData", this.getNextHighestDepth());
loadVariables("Map/lotes.txt", loteData);
function checkParamsLoaded() {
if (loteData.done == undefined) {
trace("not yet.");
} else {
trace("finished loading. killing interval.");
trace("-------------");
for (i in loteData) {
lote = loteData[i].split(",");
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].lotename = lote[2];
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType = lote[3];
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteBlock = lote[0];
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteNum = lote[1];
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].lotePath = lote[0]+"."+lote[0]+lote[1];
trace(_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType);
var myColor = new Color(_root.Map.Map[lote[0]][lote[0]+[lote[1]]]);
// Get Lote Type
if (_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType == "Bar") {
trace("This is a bar");
myColor.setTransform({ra:100, rb:255, ga:0, gb:0, ba:0, bb:0});
} else if (_root.Map.Map[lote[0]][lote[0]+[lote[1]]].loteType == "Restaurante") {
trace("this is a restaurante");
myColor.setTransform({ra:0, rb:0, ga:100, gb:255, ba:0, bb:0});
}
//
_root.Map.Map[lote[0]][lote[0]+[lote[1]]].setTransform(_root.ColorTrans);
_root.Map.Map[lote[0]][lote[0]+[lote[1]]]._alpha = 100;
}
trace("-------------");
clearInterval(param_interval);
}
}
var param_interval:Number = setInterval(checkParamsLoaded, 100);
Dynamic Path Variables And The "with" Statement
Hi,
here is a sample bit of my code that I am trying to put a dynamic path in:
Code:
filepath = d1.riviera_1
with (_parent._parent.filepath) {
_alpha = 100;
Increment(50, 4);
}
If I us the path _parent._parent.d1.riviera_1 in the "with" statment everything works as it should. For some reason the "with" statement does not like the variable filepath. I have tried all things I can think of like using "", eval, var, and cobination there of. Any Ideas on what the problem might be.
Dynamic Path Variables And The "with" Statement
Hi,
here is a sample bit of my code that I am trying to put a dynamic path in:
Code:
filepath = d1.riviera_1
with (_parent._parent.filepath) {
_alpha = 100;
Increment(50, 4);
}
If I us the path _parent._parent.d1.riviera_1 in the "with" statment everything works as it should. For some reason the "with" statement does not like the variable filepath. I have tried all things I can think of like using "", eval, var, and cobination there of. Any Ideas on what the problem might be.
Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails.
[Flash CS3 (Flash 8 available as well)]
[Actionscript V2 (AS3 Not available for this project. End result must be in AS2. Plus I haven't learned AS3 yet)]
Hi
Sorry about running two posts so close together, but I couldn't change the other one to reflect the changes I've made in my problem.
The 1st post dealt with my theory that my IF statement wasn't written correctly, and so failed. But I've since disproved that.
Okay here is the situation.
I isolated elements from a larger app that I'm putting together and the problem still followed.
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) {
if (success) {
//point to the first node with information
var track_xml = data_xml.firstChild;
//loop through each node
while (track_xml != null) {
//print out each node
test1 = track_xml.toString();
//point to the next node
track_xml = track_xml.nextSibling;
//Runs my code
//Define the contents of two text fields located in the movie
textOne = data_xml.firstChild.childNodes[3].firstChild;
textTwo = data_xml.firstChild.childNodes[5].firstChild;
trace("data_xml.firstChild.childNodes[3].firstChild = " + data_xml.firstChild.childNodes[3].firstChild);
trace("data_xml.firstChild.childNodes[5].firstChild = " + data_xml.firstChild.childNodes[5].firstChild);
/*dummyYes = data_xml.firstChild.childNodes[5].firstChild;
dummyNo = data_xml.firstChild.childNodes[6].firstChild;
dummyMaybeEmail = data_xml.firstChild.childNodes[3].firstChild;
dummyMaybeFax = data_xml.firstChild.childNodes[4].firstChild;*/
//Checks between the two text fields for a match
if (textOne == textTwo) {
trace("It is selected!" + textOne + " " + textTwo);
check_fax.selected = true;
} else {
trace("Ir is NOT selected!" + textOne + " " + textTwo);
check_fax.selected = false;
};
}
} else {
trace("error reading file");
}
delete data_xml;
};
data_xml.load("XML/dummy2 - email.xml");
};
After you read the code, you'll have noticed the trace commands I stuck in there.
They send this to the output panel:
Code:
data_xml.firstChild.childNodes[3].firstChild = 1
data_xml.firstChild.childNodes[5].firstChild = 1
Ir is NOT selected!1 1
So as far as I can see, it reads the XML file with no problems, it loads the text fields with no problem. But for some reason the IF statement refuses to recognize that both the XML nodes contain the same information.
If I alter the code like so:
Code:
textOne = 1;
textTwo = 1;
Then the IF statement works. It sees that the two text fields are identical in content, and the checkbox is selected.
So whats wrong with the Data from the XML file?
I haven't a clue.
I tried converting from a string to a Numeral using:
Code:
newText = Number(textOne);
But that didn't work, it just produced "NaN" when traced.
I tried populating the XML file with text versus numbers, still no luck.
What came from the trace:
Code:
data_xml.firstChild.childNodes[3].firstChild = hi
data_xml.firstChild.childNodes[5].firstChild = hi
Ir is NOT selected!hi hi
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.
I'd really appreciate some help and suggestions with this, I think I'm out of ideas.
Thanks
-Lem
Problem With Continue Statement And Label Statement
What am I doing wrong?
ActionScript Code:
var a = {
a:[1,2,3,4,5,6,7,8,9,0],
b:[1,2,3,4,5,6,7,8,9,0],
c:[1,2,3,4,5,6,7,8,9,0],
d:[1,2,3,4,5,6,7,8,9,0],
e:[1,2,3,4,5,6,7,8,9,0],
f:[1,2,3,4,5,6,7,8,9,0],
g:[1,2,3,4,5,6,7,8,9,0]
}
outerLoop: for(var i in a){
trace(i);
for(var j in a[i]){
trace(' '+j);
continue outerLoop;
}
}
Quote:
1039: Target of continue statement was not found.
Two Variables In An "if" Statement?
Can I check TWO variables in an "if" stament - something like this:
if (_global.about == 1 and _global.location == 1) {
gotoAndPlay(frame);
} else if (_global.products == 1) and _global.location == 2) {
gotoAndPlay(frame);
}
Not sure if that would be the right syntax using "and" - but can I do somethign like that?
Converting 'If Else' Statement To A 'switch' Statement
I am attempting to convert the following If statement to a Switch statement and I'm unclear as to the details of the execution of it. If someone could help me with this I would be very grateful. Here is the If statement followed by the shell of my attempted switch statement. TIA.
var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;
btn.onRelease = function() {
f (spotOne) {
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
} else if (spotTwo) {
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
} else if (spotThree) {
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
} else {
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
}
};
---------------------------------
(attempt at conversion to switch)
var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;
btn.onRelease = function() {
var location:Number = ?
switch(location) {
case spotOne:
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
break;
case spotTwo:
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
break;
case spotThree:
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
break;
case spotFour:
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
break;
}
Need A Simple If/else Statement, SOSneed A Simple If/else Statement, SOS
hi, i'm a new learner.
currently, doing an exercise on button.
i want to do a navigation button like
www.fendi.com (pls refer, thx ; )
where button that onPress it will remain,
the rest not clicked, will fade out.
i think i need a right if/else statement.
i've tried few, but still not working.
i have my flash file attached.
hope some experts here can help.
hear from you guys soon, thanks
EXTREMELY URGENT - Creating Global Variables Using Names Of Other Variables...
I have variables xtile and y tile within a movie, and I need to create a global variable that will tell all other movies that this particular movie is situated on tile [xtile][ytile], so I need to know how to create the global variable: _root.objectmovie_xpos_xtile_ypos_ytile = true;
I know how to create global variables, and how to have other movies read them, but how do I actually create a VARIABLE with this name? I tried set ("_root.objectmovie_xpos_" + xtile + "_ypos_" + ytile") = true, but that doesn't work (which I kinda knew already but thought I would give it a shot)
any ideas peeps?
please help, its vital to a project I am doing
cheers all
My Variables Load With LoadVars...how Do I Execute A Loop To Assign Variables?
I have 52 (one for each week) duplicated MCs, a loadVars(), and variables "sermonTitle" and "airDate," which I'm trying to assign with the following:
this.airDate=_root.loadContent["airDate" + sermonDate];
this.sermonTitle=_root.loadContent["sermonTitle" + sermonDate];
which is placed in an onClipEvent (enterFrame) handler of the button which is duped . The vars load when I click Video > 2001.
The vars loaded have values named sermonTitle1, sermonTitle2, etc. and the same for airDate. The numbers attached reference the sermonDate which has already been assigned though my duplicateMovieclip loop:
num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
trace(this["b"+n].sermonDate);
n = n + 1;
}
I've tried attaching the assign code to the dupMovieClip loop:
num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
this["b"+n].airDate = "airDate" + n;
this["b"+n].sermonTitle = "sermonTitle" + n;
trace(this["b"+n].sermonDate);
n = n + 1;
}
setProperty("b", _visible, 0);
and it works - as far as assigning the correct value to the correct button, but it does not associate the loaded vars with them.
The SWF is VERY sluggish, though, which makes me think the onclipEvent is not the best way of assigning vars. I get the trace(this) showing all of the variables loading, so I know that's not the problem.
Does anyone know how to best assign these? I have been advised to use a loop for it. How would I go about executing a loop for this, as I will have navs loading in different text files - Thanks
Link to SWF:
HERE
Virtual Student Yrbook: Variables>Arrays>Variables? SOMEBODY RESCUE ME
Hello, All.
I am totally stumped. I am creating a student virtual yearbook, which displays students names with pictures. I cant find a totally understandable tutorial that teaches me how to extract variables from an array. So I created an asp file that writes out all of the student records to different variable names, and load them using loadvariablesnum(). Using this ASP file works, but once I click the exit button to take me back to the front page, it is as if all of my other variables are erased.
I dont completely understand levels when it comes to loading variables, so everything is loaded like this
loadVariablesNum("http://10.0.1.2/tp/tpod/processGet_studentInfo.asp", 0, "GET"); --- "POST" gives me the same results...
To view the pictures you would click a button on SCENE 4, and it takes you to "VIEW STUDENTS PICTURES" - SCENE 11. 'EXIT' sends you back up to Scene 4, which runs an ASP file which simply grabs a message that is updated every 30 minutes. What Level would I use here??? I have tried many.
Everything works beautifully until I exit the VIEW STUDENTS PICTURES page from Scene11
I've written a pretty sizeable file that uses lots of variables.
I am pretty sure that the problem is with the ASP file: "processGet_studentInfo.asp" - because when I comment it out, the application works fine.
::::::::::::SUPPORTING INFO BELOW:::::::::::::::
Here are the variables that "processGet_studentInfo.asp" creates:
&varStudent1=Crystal&varImagePath1=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCrystal%2Ej pg&varStudent2=Brandy&varImagePath2=http%3A%2F%2F1 0%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrandy%2Ej pg&varStudent3=Angel&varImagePath3=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAngel%2Ejpg &varStudent4=Cathy&varImagePath4=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCathy%2Ejpg&v arStudent5=Destiny&varImagePath5=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FDestiny%2Ejpg &varStudent6=Amber&varImagePath6=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAmber%2Ejpg&v arStudent7=lester&varImagePath7=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Flester%2Ejpg&v arStudent8=paul&varImagePath8=http%3A%2F%2F10%2E0% 2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fpaul%2Ejpg&varSt udent9=Ginger&varImagePath9=http%3A%2F%2F10%2E0%2E 1%2E2%2Ftp%2Ftschool%2Fimages%2FGinger%2Ejpg&varSt udent10=Brittany&varImagePath10=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrittany%2Ejpg &varStudent11=chad&varImagePath11=http%3A%2F%2F10% 2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fchad%2Ejpg&v arStudent12=jaden&varImagePath12=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fjaden%2Ejpg&v arStudent13=Jami+Lynn&varImagePath13=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJami+Lynn %2Ejpg&varStudent14=kara&varImagePath14=http%3A%2F %2F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fkara%2 Ejpg&varStudent15=Cody&varImagePath15=http%3A%2F%2 F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCody%2Ej pg&varStudent16=darla&varImagePath16=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fdarla%2Ej pg&varStudent17=Jenna&varImagePath17=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJenna%2Ej pg&varStudentCount=17&varENDER=1
-----------------------------------------------------------
Here is the meat & potatoes of the ASP file that created this:
oRS.Open "SELECT * FROM STUDENTS", oConn, 2, 3
' Move to the first record
oRS.MoveFirst
'Loop to output all the query results to the document
do while not oRS.eof
' counter to give each record a sequential listing
counter=counter+1
Response.Write "&varstudentname" & counter & "=" & Server.URLEncode(oRS("studentname"))& "&varImagePath"& counter & "=" & Server.URLEncode(oRS("ImagePath"))
' move to the next record
oRS.movenext
loop
'LET FLASH KNOW THAT WE ARE DONE RETRIEVING
Response.Write "&varStudentCount=" & counter
Response.Write "&varENDER=finished"
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::
Please help.
Like Statement
Is there a way to do a "like" statement like an ASP database record seatch?
What i need to do is find a number in a list of number that is returned from my asp. The value list looks like this..
&Values=0|1||2||3||4||5||6||7||8||9|10|
What i want it to do is if |3| is found in that string then it will show a movie clip. If is not found in the string it will not show the movie clip. Is there away to search a string for a value?
If Statement
Hi,
I have a problem (see the files I included).
What do I want: when somebody presses on the left arrow button that the timeline goes to frame number 10.
In frame 3 (in the main timeline) I wrote:
If ("/:film1richting"=-2)
Go to and Stop (10)
Else
Go to and Play (2)
End If
This doesn't work. I don't know why because the variable is -2 (see the arrowleft button actionscript)when somebody presses the left arrow button. I don't want to solve this problem by writing a simple actionscript in the left arrow button: On release go to frame 10. But I want to use the if statement in frame 3. Does anybody know what I must do?
http://members.home.nl/u-p/movement.swf
http://members.home.nl/u-p/movement.fla
Thanks
[Edited by U.P! on 08-21-2001 at 07:32 AM]
With Statement
I could really use some help here.
I am trying to build a inverted tree. With one object at
the top and then on the next level down there will be 2
objects and so on and so on. I've decided to use
movieclips. I made a movieclip and set linkage.
it's name is "node". If I am doing this dynamically
using the attachmovie() I have to assign a name and a level,
so I do that. Now for the location I have decided to use
the "with", because I have dynamically attached the movie
I do not know what the name is, so I try to build a
name string and pass it to the "with" statement. this
does not work.
here is the code, it is start when you hit a button.
ndx = 1;
powersof = 1;
xmove = 25;
ymove = 25;
index = 1;
count = 1;
if (_root.TextField6 == "anatomy") {
while (index<=_root.anatomy.length) {
if (index == 1) {level_movie = "node_"+ndx;
_root.attachmovie("node", level_movie, ndx);
currentmovie = "_root." + level_movie;
with (currentmovie) {
_x = 138;
_y = 90;
ndx++;
}
} else {
}
while (count<=Math.pow(2, index)) {
level_movie = "node_"+ndx;
_root.attachmovie("node", level_movie, ndx);
currentmovie = "_root." + level_movie;
with (currentmovie) {
_x = 138+(xmove*count);
_y = 90;
ndx++;
}
count++;
}
count = 1;
index = index+Math.pow(2, powersof);
powersof++;
}
}
stop ();
I really would appreciate some help.
thanks all
my email is rbrumback@imedlink.net
If Statement
Hi guys
I think this is very simple for you but I need it
I'm trying to make a small game and I have 3 counters
win, lost and tries where tries =8 and win=0 and lost=0
it's like this
on (release) {
if (variable1==variable2){
tries--
win++
} else {
tries--
lost++
}
}
Now I want to tell the actionscript to loop until tries =0 and then go to frame 20
that's all
I know it's very easy but...
thanks in advance
If/else Statement Help
Okay guys,
I managed to figure out my other problems ... now I have a new one ...
I'm fairly new to if/else statements so I need some help with this one ...
here's what i'm doing ...
I have a series of MC's that are draggable and have target areas (meaning they will snap into position once dragged into the target area) ... now what I need to do is (or at least I think) write an if/else statement that says 'if all mc's are dropped into the target area go to and play xxx' ... how do i do this ...
help appreciated as always.
eg
If/else Statement - HELP
Should be a simple question. How do I do this correctly in actionscript?
If (_parent movie = frame2) {
gotoandPlay (frame1)
I don't really even need an else. I want it to keep going till it reaches frame2 of the parent movie.
Please Help Me With An If Statement
i'm not that big of an actionscripter, but i'm trying this thing, basically, its when u click a button it plays a certain frame within a movieclip, depending on where what frame the movie clip is already in, have a look at this::
on (press) {
if (mens_sub_buttons = (1)) {
tellTarget ("mens_sub_buttons") {
gotoAndPlay (2);
}
} else {
tellTarget ("mens_sub_buttons") {
gotoAndPlay (16);
}
}
}
if its at frame 1 i want it to play frame 2 , but if its at anything else i want it to play number 16
but it doesnt work! any ideas??
thanks alot!
If, Then Statement
I have created a drag and drop application, and now I want to add a few rules. I have assigned values to the different MCs and I want to create an If, then statement that will add the movie clips as they are dropped into the target area. So when a certain value is achieved it will not let any other objects to be dragged in until pieces are taken away. Can someone help me out, I'm not sure where to start.
Can Someone Help Me With An If Statement
I am having some brain blockage regarding an if statement. The idea is simple if a score is x then the variable is y, but if the score is w or z the variable is b. Can someone help. There are 17 layers to this statement.
|