If Statement Not Working.
This statement isn't working
if (mc1=true){mc2=mc2+20}
It's on the main timeline, and as soon as it hits that frame with the code, it makes mc1 true, and performs mc2=mc2+20, even though before that mc1=false. Whats wrong??
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 01-13-2007, 02:04 PM
View Complete Forum Thread with Replies
Sponsored Links:
[FMX] If Statement Not Working
Hi,
I am making a music player on my site..
it contains:
play button
next button
prev button.
in the play button, i've assigned the following code:
**********************
on (release) {
stopAllSounds();
Song1.start();
Playing1 = true;
Playing2 = false;
Playing3 = false;
current_song = title1;
}
**********************
in the next button the following code:
**********************
on (release) {
if (Playing1=true) {
stopAllSounds();
Song2.start();
Playing1 = false;
Playing2 = true;
Playing3 = false;
current_song = title2;
} else if (Playing2=true) {
stopAllSounds();
Song3.start();
Playing1 = false;
Playing2 = false;
Playing3 = true;
current_song = title3;
} else if (Playing3=true) {
stopAllSounds();
Song1.start();
Playing1 = true;
Playing2 = false;
Playing3 = false;
current_song = title1;
}
}
**********************
It only works half...
If i push the next button, it starts the second song...
but when I push it again... it starts the second song again...
It doesn't play the 3d song...
Can somebody help me?
View Replies !
View Related
If Statement Not Working ;(
createEmptyMovieClip("h_user",1);
createEmptyMovieClip("h_upgrade",2);
_root.h_upgrade.loadVariables("userplan.php"); userplan = _root.userplan;
h_user.loadMovie("user.swf");
if (userplan < 4) {
h_upgrade.loadMovie("upgrade.swf");
}
this is on the first frame+layer of my movie, it loads both movies fine, but ignores my if statement. userplan.php outputs a variable for it, so im at a loss for what the problem is.
View Replies !
View Related
If Statement Not Working
Hi All
Can someone take a look at this if statement and see what Im doing wrong.
if((ageCombo.getValue() == horse1.age || ageCombo.getValue() == horse1.nb) and (colorCombo.getValue() == horse1.colour || colorCombo.getValue() == horse1.nb) and oddsCombo.getValue() == horse1.odds and lastRanCombo.getValue() == horse1.placed){
horseToDisplay.push(horse1.name);
}
Basically what Im trying to say is the age combo box will either return a value or nb, the same with the colour.
Im not getting any errors in the script but its still not working.
Thanks
View Replies !
View Related
If Else Statement Not Working
I've been trying to get these 'If else' statements to work properly and sometimes they work and sometimes they don't.
I have six buttons that when released call a variable.
button one calls this variable :
on (release) {
section = "section01";
checkSection();
} . . . and so forth for all the buttons.
Then I have this code on a frame :
function checkSection() {
if (section == "section02") {
_root.fader02.play();
} else if (section == "section03") {
_root.fader03.play();
} else if (section == "section01") {
_root.fader01.play();
} else if (section == "section04") {
_root.fader04.play();
} else if (section == "section05") {
_root.fader05.play();
} else if (section == "section06") {
_root.fader06.play();
}
}
But it seems as though the function is not working, I've tried it many ways. With quotes and without, even using the variable in an absolute path and nothing still. I herd that on maybe it's only getting called once and I don't fully understand this - amybe this is my problem - - Can anyone offer any
insight here ??
Thanks.
View Replies !
View Related
If Else Statement Not Working?
Hello, I have a movie clip that is giving me some trouble. Inside my movie clip I declare a boolean variable to = false on the first frame of the movie clip. On the last frame of my movie clip I set the variable to = true. On the last frame there is also a button that goes to frame 33 on my movie clip and plays. Around frame 50 or so I have an if else statement I "believe" says that if the variable = true go to the last frame and stop, else if the variable = false to keep playing the movie clip.
Anyways, I can't seem to figure out what the deal is. I've been messin with it for way to long. Any idea's or suggestions would be greatly appreciated. Here's the link to the .fla file...
http://www.boomspeed.com/danarchy/401k.fla
, Stea|th
View Replies !
View Related
If Statement Not Working
I have a button with this code on it...
on (release) {
if (_root.title.titleOn=false) {
}
if (_root.title.titleOn=true) {
_root.title.gotoAndPlay("titleOut");
}
}
This should tell the movie clip "title" that if it's on, turn it off by jumping to "titleOut" in my timeline. At the beginning of the timeline and at the stop of the animation, I set the variable "titleOn" to true(_root.title.titleOn=true.
At the end of the timeline where the animation stops and disappears, I set the variable "titleOn" to false(_root.title.titleOn=false.
The button turns my animation off, but when clicked again, it replays the "off" animation. What have I done wrong here? Thanks
View Replies !
View Related
If Statement Not Working?
Hi folks.
I've got a movie clip called 'soundToggle'. It's default position points to 9 (imagine a clock face). On click, it rotates via 12 and points to 3. Here comes the problem. When I click it again, I want it to rotate back to 9 (via 12) but it doesn't.
The first part works fine, but when you click it a second time it does nothing. I've traced the statement and I'm not sure why. Here's the code I use on a frame:
_root.soundToggle.rot = 0;
_root.soundToggle.music=true
_root.soundToggle.onPress = function() {
this.onEnterFrame = function() {
if (this.music)
{
if (this.rot < 180)
{
this.rot= this.rot+4;
this._rotation = this.rot;
}
this.music=false
}
else if (this.rot > 0)
{
this.rot= this.rot-4;
this._rotation = this.rot;
}
this.music = true
}
}
Any help would be much appreciated.
View Replies !
View Related
If Statement Not Working
Hi,
I have a problem with my if statements. I have a word and picture displayed on the screen. If the word and picture match the user presses the left arrow key for yes. This adds 1 point to the score. If the word and picture do not match then they press the right arrow key for no. This also adds 1 point to the score cos its the right answer. However the problem I have is if the user presses yes when the picture and word do not match. This should then minus 1 from the score because its the wrong answer. And the same should happen if the word and picture match and they press no.
I have this code on a blank yes button on the stage.
if (varWord ==varPic) {
score++;
}else{
score--;
}
this code is on the no button
if (varWord !=varPic) {
score++;
}else{
}
score--;
}
As the moment its subtracts the score if the word and picture match and you press yes. I think its matching whether the word and picture match rather than actually whether the key press is correct.
Ive attached my fla. Can anyone see where this is going wrong?
Thank you
View Replies !
View Related
If Statement Not Working
i have a button that is supposed to make a contact panel appear when you press it and make the panel close when clicked again. i'm trying to do it using if statements but it's not working. in the file the button i'm tlaking about is the circle to the right (3rd out of 3)
View Replies !
View Related
If/Then Statement Not Working
Hi, I'm new here, and I'm sure this question has been asked before, but here it is again anyways.
I'm pretty new to Actionscript, and I'm trying to create an application similar to the card game "war", wherein the computer generates two random numbers, evaluates which number is higher, and then displays text dependent on the outcome. I have the random numbers part working fine, but everything else is kind of screwed up. Here's the code I have attached to the "Deal cards" button:
Code:
on(click) {
with(_parent){
card1_txt.text = Number (random(12));
card2_txt.text = Number (random(12));
}
if(card1_txt < card2_txt){
winlose_txt.text = String("Loser!");
}
}
Using this code, both numbers are generated, but the dynamic text box I have set to display the value of winlose_txt never displays anything, so I think its a problem with the if/then statement. Can anyone help a n00b out?
Thanks!
View Replies !
View Related
For Statement Not Quite Working
code:
function flasher () {
trace ("flasher running");
count = 20;
for (i = 0; i < count; i++) {
flashs = (i % 5) ? "0" : "1";
trace ("flasher=" + flashs);
win11._visible = flashs;
}
}
If i am right this should make win11 flicker 4 times but it aint
I dont need to use a onEnterFrame for this do i?
View Replies !
View Related
For Statement Not Working
hi there
i am having trouble loading thumbnails into containers using the for statement.
there are 30 containers and want to use a for statement instead of typing out 30 lines of loadMovie. I have tried to use this but it doesnt work.
Code:
for(i=1; i<31; i++)
{
this['thumbHold'+i].loadMovie('images/thumb'+i+'.jpg');
}
the image being thumb1.jpg........thumb2.jpg .......so on
Please please help ....
View Replies !
View Related
If Statement Is NOT WORKING
Hi,
Last post now hopefully today!
I have worked round my last two problems with a bit of help but now i want the check button to check to see if the child who has inputted the answer has got the question right.
If the answer is right it should be as folllows
if num5 = num1 + num2 play mysoundsgood(10)
or if it's not play mysounds(10)
I have tried numerous combinations but still not getting it to work!
Any ideas everyone?
Also how do I get the cursor to flash in num5 when you click the 'Get Calculation' button?
Cheers
Chris
View Replies !
View Related
If Statement Is Still Not Working Help Please
Hi,
Last post now hopefully today!
I have worked round my last two problems with a bit of help but now i want the check button to check to see if the child who has inputted the answer has got the question right.
If the answer is right it should be as folllows
if num5 = num1 + num2 play mysoundsgood(10)
or if it's not play mysounds(10)
I have tried numerous combinations but still not getting it to work!
Any ideas everyone?
Also how do I get the cursor to flash in num5 when you click the 'Get Calculation' button?
Cheers
Chris
View Replies !
View Related
If Statement Not Working..
I do not seem to be able to make my IF statment work!?!
First frame I setup a varable:
Code:
var stat=0; var user=""; var pass="";
I pop up an input box for user name and password. Having collected the data I send it to a php page and wait for a reply
Code:
login.onRelease = function (){
send.user = user
send.pass = pass
send.sendAndLoad("http://127.0.0.1/chat/login.php", receive, "POST");
}
receive.onLoad = function()
{
trace (this.ready);
trace (this.stat);
gotoAndStop(3);
}
This part works and returns the values I would expect..
At the next frame I have this code..
Code:
if (stat = 1)
{
gotoAndPlay(4);
status = "OnLine";
trace("Set Online");
}
else
{
gotoAndPlay(1);
}
This should goto fram 4 if the login went ok and goback to frame 1 if the returned status is not 1..
Why is this not working? I even tried if (stat = "1") still will not work.. It always goes to frame 4
View Replies !
View Related
[F8] If Statement - Why Is This Not Working?
Hello,
I thought I understood the "if" statement but it seems i don't.
Could someone tell me why this doesn't work.
I have attached a test .fla file.
I have a movie clip on the stage.
When you click it it moves across the stage.
When it gets there I no longer want it to be clickable (or have any of the previous AS associated with it.
So, I put the button functions in an "if" statement and used a Boolean variable to say 'only do this stuff if the var == true.
PHP Code:
stop();
var buttonWorks:Boolean = true;
if(buttonWorks == true){
circleMc.onPress = function(){
gotoAndPlay(20);
circleMc.gotoAndStop(1);
}
circleMc.onRollOver = function(){
circleMc.gotoAndStop("over");
}
circleMc.onRollOut = function(){
circleMc.gotoAndStop(1);
}
}
Then on the frame where the circleMc moves to i change the var to false.
This just doesn't work!!
Could someone explain why, or what I've done wrong.
I'm trying to learn this AS stuff!
View Replies !
View Related
[F8] Why Is This IF Statement Not Working?
I've got a button which is sending commands to _parent.one MC. If works up to the first "else if" but after that it won't follow through with the command even though the trace is showing that that _parent.two is equaling 10. Why does this simply not work?
Code:
adam.onRelease = function() {
trace(_parent.two._currentframe);
if (_parent.one._currentframe == 1) {
_parent.one.gotoAndStop(10);
} else if (_parent.one._currentframe == 10) {
_parent.two.gotoAndStop(10);
} else if (_parent.two._currentframe == 10) {
_parent.two.gotoAndStop(30);
}
};
Cheers!
View Replies !
View Related
[F8] If Statement Not Working
I am using the LoadVars object and from that I am using the sendandload method. The data sends to the Java Servlet I am using and in turn the servlet returns a result. The problem is that the if statement i am using does not seem work. I should of mentioned the program is a simple username and password checker.
Code:
on (release) {
myVars = new LoadVars();
myVars.login = "true";
myVars.name1 = _root.nameText.text;
myVars.password1 = _root.passwordText.text;
myVars.sendAndLoad("http://localhost:8080/djs/Test", myVars, "post");
myVars.onLoad = function (success:Boolean) {
if (success) {
_root.lblLogin.text = "TempLogin is " + myVars.login;
if (this.login == "1") {
_root.lblLogin.text = "TempLogin is " + myVars.login;
}
}
}
}
Can anyone please help?
View Replies !
View Related
The If() Statement Is Not Working
hi guys.. check this out.. in my database, i have a field called CategoryType and its type is: char.
In flash mx, i grab the data of CategoryType (XML file type) and i got MF.
CategoryType = myData.firstChild.firstChild.childNodes;
when i put this:
if(CategoryType == "MF"){
trace("hello")
}
but its not working! Any idea?
View Replies !
View Related
If Statement Not Working
Please Help Me
i have made a if & else if code in it but it dosen't check the conditional & executes the code in the if bit.
Here is the code::
function PTurn() {
if (playerturn == 1) {
var colorful = new Color(_root.instName);
colorful.setRGB(0x0000FF);
btn_enabled = false;
} else if (playerturn == 2) {
var colorful = new Color(_root.instName);
colorful.setRGB(0xFF0000);
btn_enabled = false;
}
}
View Replies !
View Related
For Statement Not Quite Working
ActionScript Code:
function flasher () {
trace ("flasher running");
count = 20;
for (i = 0; i < count; i++) {
flashs = (i % 5) ? "0" : "1";
trace ("flasher=" + flashs);
win11._visible = flashs;
}
}
If i am right this should make win11 flicker 4 times but it aint
I dont need to use a onEnterFrame for this do i?
View Replies !
View Related
If Statement Not Working
Hi--
I've searched around and can't seem to understand why this wouldn't work:
ActionScript Code:
function tweenTxt(){
textBG_mc.tween("_height", 427.9, 1.5, "easeInOutCirc");
if(textBG_mc._height == 427.9){
trace("that actually worked!");
}
}
I've tried setting a variable = textBG_mc, and Math.round, maybe I'm not getting the context right, I've tried this.textBG_mc.etc, hmmm. The if is not returning true, is that something with the tween?
Any help would be appreciated.
Thanks
View Replies !
View Related
If Statement = Working
I’m loading Flash vars from my page using a Javascript shown here:
quote:<script type="text/javascript">
var1 = "foo";
var2 = "";
</script>
I'll make this short. The vars do get into my Flash movie and all works fine when the vars have values. But I need to check if the vars have values and if not skip a function.
Here is the if statement I’m having trouble with:
quote:
if (var2=!undefined) {
attachMovie("MC", "MC", 1);
}
If var2 has no value, the MovieClip "MC" still gets shown.. I've tried adding var2=null; in the JavaScript but the MovieClip is still shown. I know "if var2 not undefined" is probably a strange way to check a value. I've tried "if var2 undefined - return;} else { attach MovieClip" and that doesn't recognize the empty value either :(
Any help is greatly appreciated!
View Replies !
View Related
'IF' Statement Not Working Right
I have a chat window much like MSN Messenger I made in flash, and I am trying to get it to be able to carry on a conversation with the user... Keep in mind that this script is attached to a button, user field is where the user types, and reply is where they see their reply.
this chat is suposed to be able to keep a small conversation with a child, and I use 1 and 2 letter variables to help control the bot to tell it where it should be in the conversation. If you read over the source, it should give you some idea on where I am trying to go with it...
The problem it, the variable Q is not progressing to 1, it is staying on 0.
Here is the source...
Attach Code
on (release, keyPress "<Enter>") {
_root.reply.htmltext = _root.reply.htmltext+"<b>"+kname.text+": </b>"+_root.user.text;
_root.user.saveText = _root.user.text.toLowerCase();
function respond() {
/*************************************************************************************************/
/*
Q = main question database
x = Has santa asked user what they would like for christmas
1 = Yes
0 = no
xa = Has the previous question been answered?
1 = Yes
0 = no
z = Has Santa asks for users fav reindeer
1 = Yes
0 = no
za = Has the previous question been answered?
1 = Yes
0 = no
gb = Has Santa asked is user was good
1 = Yes
0 = no
gba = Has the previous question been answered?
1 = Yes
0 = no
*/
trace("Q is "+Q);
if (Q == 0) {
if (bg = 0){
//_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Have you been good this year?";
_root.status.text = "";
gb == 1;
}
else
if (_root.user.saveText.indexOf("yes") != -1 || _root.user.saveText.indexOf("yeah") != -1 || _root.user.saveText.indexOf("yup") != -1 || _root.user.saveText.indexOf("yea") != -1 || _root.user.saveText.indexOf("sure") != -1 || _root.user.saveText.indexOf("yah") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Great, that’s what my list tells me! Let’s make up your Christmas list! :)";
_root.status.text = "";
Q = 1;
gba == 1;
gotoAndPlay(11);
} else
if (_root.user.saveText.indexOf("no") != -1 || _root.user.saveText.indexOf("nah") != -1 || _root.user.saveText.indexOf("not") != -1 || _root.user.saveText.indexOf("nope") != -1 || _root.user.saveText.indexOf("na") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I'm sorry to hear that but, according to my list, I think you have been very nice this year and I would still like to give you something special. Lets make a Christmas list! :)";
_root.status.text = "";
Q = 1;
gba == 1;
gotoAndPlay(11);
} else
trace("Q currently equals "+Q);
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Im sorry, I did'nt understand what you said, have you been good this year?";
Q = 0;
gb == 1;
gba == 0;
gotoAndPlay(11);
}
else
if (Q == 1) {
if (x=0){
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What would you like for Christmas this year?";
_root.status.text = "";
x=1;
}
var randNum=Math.round(Math.random()*10)
if (randNum==0) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Got it! What else would you like?";
_root.status.text = ""; }
if (randNum==1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> That is popular this year, what else would you like?";
_root.status.text = ""; }
if (randNum==2) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Wonderful, what else would you like?";
_root.status.text = ""; }
if (randNum==3) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Jotted on my list, what else would you like?";
_root.status.text = ""; }
if (randNum==4) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Very nice, what else would you like?";
_root.status.text = ""; }
if (randNum==5) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Great, what else would you like?";
_root.status.text = ""; }
if (randNum==6) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> That is a popular request this year! What else would you like?";
_root.status.text = ""; }
if (randNum==7) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Good choice! What else would you like?";
_root.status.text = ""; }
if (randNum==8) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Very nice, what else would you like?";
_root.status.text = ""; }
if (randNum==9) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Wonderful idea, what else would you like?";
_root.status.text = ""; }
// Q 1 EXIT CODE START
if (_root.user.saveText.indexOf("quit") != -1 || _root.user.saveText.indexOf("exit") != -1 || _root.user.saveText.indexOf("imdone") != -1 || _root.user.saveText.indexOf("nomore") != -1 || _root.user.saveText.indexOf("nothing") != -1 || _root.user.saveText.indexOf("done") != -1 || _root.user.saveText.indexOf("finished") != -1 || _root.user.saveText.indexOf("complete") != -1 || _root.user.saveText.indexOf("all") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> •We have quite a list! Before I close my book, is there anything else you would like me to add?";
y=1;
}
if ( y = 1 && _root.user.saveText.indexOf("no") != -1 || _root.user.saveText.indexOf("nah") != -1 || _root.user.saveText.indexOf("not") != -1 || _root.user.saveText.indexOf("nope") != -1 || _root.user.saveText.indexOf("na") != -1 || _root.user.saveText.indexOf("done") != -1 || _root.user.saveText.indexOf("finished") != -1 || _root.user.saveText.indexOf("complete") != -1 || _root.user.saveText.indexOf("all") != -1) {
_root.status.text = "";
Q = 3;
X = 1;
gotoAndPlay(11);
}
else if ( y = 1 && _root.user.saveText.indexOf("yes") != -1 || _root.user.saveText.indexOf("yeah") != -1 || _root.user.saveText.indexOf("yup") != -1 || _root.user.saveText.indexOf("yea") != -1 || _root.user.saveText.indexOf("sure") != -1 || _root.user.saveText.indexOf("yah") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What would you like for Christmas this year?";
Q = 1;
x = 1;
}
// Q 1 EXIT CODE START
}else
if (Q == 3) {
if ( z = 0 ) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Tell me who your favorite reindeer is and I will tell you a little about them.";
z = 1;
} else if ( z = 1 ) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What other reindeer would you like to know about?.";
z = 1;
}
if (_root.user.saveText.indexOf("Dasher") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Dasher was the first reindeer and the right-hand leader of the sleigh before Rudolph was included? He is the speediest reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Dancer") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Dasher was the second reindeer and the left leader before Rudolph was included? She is the graceful reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Prancer") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Prancer was the third reindeer and on the right in the second row. He is the most powerful reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Vixen") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Vixen was the fourth reindeer and on the left-hand side in the second row? She is beautiful and also powerful like her companion Prancer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Comet") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Comet was the fifth reindeer and on the right-hand side in the third row. He brings wonder and happiness to children when we fly over everyone's houses.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Cupid") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Cupid was the sixth reindeer and on the left-hand side in the third row. She brings love and joy to children when we fly over everyone's houses.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Donner") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Donner was the seventh reindeer and on the right-hand side in the fourth row. His original name was Dunder, a variant of donder, meaning 'thunder' in Dutch.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Blitzen") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Blitzen was the eighth reindeer and on the left-hand side in the fourth row. Though female, she is frequently thought to be male. Her original name is Blixem. She is known as the lightning reindeer because the word 'Blitz' is German for lightning, as is 'Bliksem', her original name, in Dutch.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Rudolph") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Rudolph was the son of Donner, and was born with a glowing red nose, which made him an outcast among the other reindeer? I remember one Christmas eve it was too foggy for me to make my flight around the world. I suddenly noticed Rudolph's nose, and decided it could be a guide for my sleigh. Since then Rudolph has been a permanent member of my team, and leads us on our way.";
_root.status.text = ""; }else
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I don't remember that reindeer. My reindeer are Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blitzen and Rudolph. ";
}else {
trace(" SCRIPT PROBLEM, Q IS OUT OF RANGE. Q CURRENTLY IS "+Q);
trace(" CLOSE PROGRAM!");
}
/* Repository Stuff
if (_root.user.saveText.indexOf("hi") != -1 || _root.user.saveText.indexOf("hello") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Hi! How are ya?";
_root.status.text = "";
} else if (_root.user.saveText.indexOf("bye") != -1 || _root.user.saveText.indexOf("later") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b>Good chatting with you!";
_root.status.text = "";
} else {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I do not understand";
_root.status.text = "";
}
*/
/*************************************************************************************************/
clearInterval(myTimer);
}
var i = 5000;
_root.status.text = "Santa Claus is typing...";
myTimer = setInterval(respond, i);
gotoAndPlay(11);
_root.reply.scroll = _root.reply.scroll*2;
}
/* ORIGINAL SCRIPT:
if (_root.user.saveText.indexOf("hi") != -1 || _root.user.saveText.indexOf("hello") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Hi! How are ya?";
_root.status.text = "";
} else if (_root.user.saveText.indexOf("bye") != -1 || _root.user.saveText.indexOf("later") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b>Good chatting with you!";
_root.status.text = "";
} else {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I do not understand";
_root.status.text = "";
}
*/
View Replies !
View Related
If Statement Not Working
Can anyone tell me why this is not working
The if works but when I add the script to change the leading which on its own works
The leading will only use the first statement even when it should not.
The if is still working for the text frame move but the leading part does not abide by the if..
What am I doing wrong
Any help would be great
var lineHeight:Number = 50;
GuestsNames.autoSize = "center";
//GuestsNames.text = ("Mighael, Bjad, Kyle, Reneka and Ryan");
GuestsNames.text = ("Mighael, Bjad, Kyle");
var descFormat:TextFormat = new TextFormat();
if (GuestsNames._height>lineHeight) {
GuestsNames._y -= Math.floor((GuestsNames._height-lineHeight)/2);
descFormat.leading = -15;
} else {
descFormat.leading = 1;
}
GuestsNames.setTextFormat(descFormat);
View Replies !
View Related
If Statement Not Working
I'm new to actionscript...
For some reason my if statement is not working. It is in a movie clip of a blinking eye and I want the code to pause the blink for 4 seconds between blinks.
The movie clip does not have an instance name (which may be the problem).
Frames 1-12 is the eye blink animation. (no script)
Frame 13
Code:
timeDelay = 4+getTimer()/1000;
Frame 14 is empty
Frame 15 is
Code:
var timeYet = getTimer()/1000;
if (timeYet >= timeDelay) {
gotoAndPlay(1);
}
gotoAndPlay(14);
When I run the movie, the varaibles change like they should according to the time, but for some reason, it skips over the if statement even is timeYet is greater than timeDelay. I probably labeled the variables wrong, but I do how they should be.
View Replies !
View Related
For Statement Not Quite Working
ActionScript Code:
</p>
<p>function flasher () {</p>
<p> trace ("flasher running");</p>
<p> count = 20;</p>
<p> for (i = 0; i < count; i++) {</p>
<p> flashs = (i % 5) ? "0" : "1";</p>
<p> trace ("flasher=" + flashs);</p>
<p> win11._visible = flashs;</p>
<p> }</p>
<p>}</p>
<p>
If i am right this should make win11 flicker 4 times but it aint:confused:
I dont need to use a onEnterFrame for this do i?
View Replies !
View Related
Working With An If Statement, Could Use Some Help, Please
Hello there,
I have a movie clip called mover that I can ease up and down with buttons, and some action script to alpha a box if the top of the mover clip goes above the top of a stopper clip.
Its an if statement and sadly only runs once. I made a controller movieclip which I thought would trigger the if statement each time the onEnterFrame was crossed... but sadly it doesnt work.
I have sreached and read alot and am just stumpped, and yes a novice at AS...
I have attached a fla below, I cleaned it up alot so it should be pretty straight forward if someone to look through. If someone is willing to take a look at it, that would be great. Or point me in a different direction.
Thanks so much,
Dale
View Replies !
View Related
Else If Statement Not Working
Here's my code:
Global variable _level0.menu_2 is populated with one of 5 values. Function exists for each value. The function for the value should only be called if the _level0.menu_2 variable matches the value. What is happening is that even though _level0.menu2 is correctly populated, only the first if statement executes--even if the first condition is NOT met.
I looked all around and can't figure out what's wrong. As far as I can tell (and I've been over the code character for character) the syntax is correct.
function loadMenu2():Void{
if (_level0.menu_2 = value1){
trace("_level0.menu_2 is value1");
value1();
}
else if (_level0.menu_2 = value2){
trace("_level0.menu_2 is value2");
value2();
}
else if (_level0.menu_2 = value3){
trace("_level0.menu_2 is value3");
value3();
}
else if (_level0.menu_2 = value4){
trace("_level0.menu_2 is value4");
value4();
}
else if (_level0.menu_2 = value5){
trace("_level0.menu_2 is value5");
value5();
}
else {
trace("no value selected");
}
}
HELP!
View Replies !
View Related
My If Else Statement Is Not Working :( Help
To start,
there are 5 tabs at the top of my page. The first one being "home", the next one being "projects". When i click on the projects tab, i created a movie clip from an external .swf that has some more tabs that kindof drop down, if you will. My movie clip is divided into sections:
_up - which has nothing on it
_on - which makes the buttons drop down
_out - which makes the buttons reverse and pop up
My dilema:
When you click on projects i have it coded
_root.secondarytabs.gotoAndPlay("_on");
which works like a charm. Then on the "home" tab, i coded it
_root.secondarytabs.gotoAndPlay("_out");
which also works like a charm. My problem is that when the home page is already on, and i click home again, it shows the buttons fly up.... which were non-existent to begin with, so it looks funny. I wanted to use some sort of "if else" statement or something to make this work properly. So i had:
if (secondarytabs == "_on") {
_root.secondarytabs.gotoAndPlay("_out")
} else {
_root.secondarytabs.gotoAndPlay("_up")
}
Thinking that if the movie is in the "_on" state, meaning the buttons are dropped down and visible, then when i click on "home" it will start the "_out" portion of the video so the buttons will jump up. Otherwise, if the video is in a different state, it will just move the video to "_up", where it will show nothing anyways.... but there is something wrong with my code becuase it doesnt work....
Please help
View Replies !
View Related
If Statement Not Working...
Hi,
anyone know why my "if" statement isnt working inside of the CLICK function? i have this working in another script by adding a "on complete" listener to the intro animation, but would prefer not to do this as i trying to cut down on script & having the "if" statement inside the click function would save me loads of scripting elsewhere...
PHP Code:
package { import flash.events.*; import flash.display.*; import flash.text.*; public class buttons extends MovieClip { private var btn1:MovieClip = new Btn(); private var btn2:MovieClip = new Btn(); private var btn3:MovieClip = new Btn(); private var btn4:MovieClip = new Btn(); private var btn5:MovieClip = new Btn(); private var Intro:MovieClip; public function buttons() { addChild(btn1); btn1.x = 20; btn1.y = 20; btn1.myText.text = "ENTER BUTTON"; btn1.addEventListener (MouseEvent.CLICK, btn1Clicked); Intro = new intro(); Intro.x = 50; Intro.y = 50; btn2.x = 20; btn2.y = 60; btn2.myText.text = "MENU1 BUTTON"; btn3.x = 20; btn3.y = 100; btn3.myText.text = "MENU2 BUTTON"; btn4.x = 20; btn4.y = 140; btn4.myText.text = "MENU3 BUTTON"; btn5.x = 20; btn5.y = 180; btn5.myText.text = "HOME BUTTON"; } public function btn1Clicked (Event:MouseEvent):void{ trace ("enter button clicked"); removeChild (btn1); addChild(Intro); if(Intro.currentFrame == 50) { removeChild(Intro); addChild (btn2); addChild (btn3); addChild (btn4); addChild (btn5); } } }}
View Replies !
View Related
Else If Statement Not Working PLEASE HELP
Hi All,
I have a menu system that animates as you roll over the button and resets itself when you roll off. The buttons change as to where your mouse has been (for want of a better solution, I have made a movie clip with all the different combinations of animations and labelled them so I can play them when needed).
So this code is on the keyframe of the movie clip that holds the buttons and the movie clip with the animation(menubg):
Code:
qualbtn.onRollOver = function () {
if (menubg._currentframe == 105 or 120 or 165){
menubg.gotoAndPlay("serv2qual");
} else if (menubg._currentframe == 15 or 60){
menubg.gotoAndPlay("tech2qual");
} else menubg.gotoAndPlay("qualrollover");
}
The code is working for the first line on each button but stops working for the second and third line.
Can anyone tell me what might be wrong with this???
Thankyou!!
View Replies !
View Related
If Statement And Tell Target...not WORKING
hi fellow flashers:
I have a navigation system inside an MC and I have the following code on a button inside the mc:
on (release) {
if (_root.section eq "portfolio") {
tellTarget ("_root.portlink") {
gotoAndPlay("loudout");
}
}
tellTarget ("_root.mainnav") {
_parent.gotoAndPlay("home");
}
}
But for some reason, the tell target inside the if statement does not work. So I tried another function like:
if (_root.section eq "portfolio") {
_parent.gotoAndPlay("home");
}
}
And this works fine so I know that the variable checking bit works. Des anywone know why my original code won't work? I am really confused as this seems like a simple thing to me.
Thanks in advance!!!!!
View Replies !
View Related
Simple If Statement Not Working
I have my main swf that calls video.swf onto the stage. Video.swf had 12 emptyclips that load dynamic thumbs. Over the thumbs I have 12 buttons. b1, b2, b3 so on so on.
Im trying to disable the buttons if there is no thumb loaded into the emptyclip.
Here is what Im trying.
if(_root.mtclip.video.h6._url== "http://www.solidtorch.com/tnike/videos/thumb6.jpg"){
_root.mtclip.video.b6.enabled=false();
} else {
_root.mtclip.video.b6.enabled=true();
}
Ive tried _parent. _root, even using and onClipevent on the MC themselves. Cant get it to work.
Any ideas why?
Josh
View Replies !
View Related
For Loop Not Working In If Statement
i don't understand why the for loop is not executing inside the if statement. the tracer "inside if(root.counter<2)" outpus, so I know the if statement is executing. but none of the tracers within the for loop output, and the attach movie doesn't work. any ideas?
Code:
function showTestRefresh() {
//some code blah blah
if (_root.counter<2) {
trace("inside if(root.counter<2)");
var i = 0;
for (var i=0; i++; i<_root.baselist.length) {
trace("_root.givenOrder[i]:"+_root.givenOrder[i]);
trace("_root.counter+1"+_root.counter+1);
_root.trialcycle.alpha.testcycle.attachMovie(_root.givenOrder[i], _root.givenOrder[i], _root.counter+1, {_x:_root.choiceGPosX[i], _y:_root.givenYpos, _xscale:25, _yscale:25, _rotation:_root.givenRot[i]});
}
// more stuff
}
View Replies !
View Related
Funky If/else Statement... Not Quite Working
So I'm working on this project that calls external swf files into a movie clip (they are called by a global variable called swfNum instead of by exact file name - helps simplfy the programming of the 'next' button.)
On some movies the project title shrinks and moves to a different part of the screen, this is managed using a varible called titleAmmo
What I need to do is check to see if the swf being loaded is one of the movies that needs a small title and make it small. If it's already small, it needs to stay small... if it's big it needs to shrink... If it's not a movie that needs a small title, i need it to grow big and if it it needs a big title and the title is big it should stay big...
boy that's confusing!
Currently what I have sits in a onRelease function right under the commands that advance the swf number and load the next movie - it goes:
Code:
// if the new swf number is one of the overviews, keep the title small, if not, grow it
if ((swfNum == 4) || (swfNum == 5) || (swfNum == 9) || (swfNum == 21) || (swfNum == 49)) {
if (titleAmmo == small) {
//trace("overview");
tellTarget ("mcPMAmmo") {
stop();
}
} else {
//trace("not overview");
tellTarget ("mcPMAmmo") {
gotoAndPlay(22);
}
titleAmmo = big;
}
} else {
// if it's not an overview, and the title is big, keep it big, if it's small, make it big
if (titleAmmo == big) {
tellTarget ("mcPMAmmo") {
stop();
}
} else {
tellTarget ("mcPMAmmo") {
gotoAndPlay(2);
}
titleAmmo = small;
}
}
it's really not working. flash says the script has no errors, so i guess the syntax is right, I just think I crossed a funny wire.
Is there a better way to do this?
Let me see if I can break down what needs to happen clearer:
The title is a movie clip (mcPMAmmo) with 2 states: big and small these are 'tweened' for fun
"overview" swfs (4,5,9,21 and 49) need the title clip small
all others (detail swfs) need the title clip big
I need to detect if the swf being loaded needs a small or big title and if the title is small or big.
then I need to respond accordingly.
the global variables at work are:
swfNum (for the number of the swf)
and
titleAmmo (for the size of the mcPMAmmo title movie clip)
I'm open to a different approach...
Thanks!
Puck
View Replies !
View Related
Simple If Statement Not Working.....HELP
What I'm doing here is just wanting to show an artists name when the next record is accessed. The "if else" is not evaluating properly. Here's what I have .
First frame I initialize my variable to 0 like this since the first is always 0
var currentSong:Number = 0;
function showArtist(songNumber)
{
trace(songNumber);
if (songNumber = 0) {
trace("A");
} else if (songNumber = 1) {
trace("B");
} else if (songNumber = 2) {
trace("C");
} else {
trace("F");
}
I call it like this:
//Randomly gets the new number stored in a variable called songNum
{....
......}
//move current artist out
showArtist(currentSong);
//move new artist in
showArtist(songNum);
//set the currentSong
currentSong = songNum;
This code always traces out "B" So my trace looks like this:
0
B
1
B
1
B
2
B
I'm baffled, Can anyone help?
View Replies !
View Related
For Statement/loop Help Not Working
I have a form full of CheckBoxes (components) (51 to be exact). And I have conveniently named them c1 through c51.. So when you click the submit button, it is supposed to check if these boxes have been checked, and those that have, send the data that belongs to those boxes. I guess I could do it like this:
Code:
if (c1.selected) {
senderLoad.c1data = c1.label;
}
but that would be way too much code for 51 of them.. So I tried a for statement:
Code:
var field:Array = new Array ();
for (var i:Number = 0; i < 52; i++) {
field[i] = "c"+i;
if (field.selected) {
senderLoad.field.label;
}
}
with different variations to the one you see above, but it doesn't work. I think it is because it doesn't recognize the "field" array as a appropriate instance to have the 'selected' and 'label' properties or something, but all I know is it won't work...
Does anyone have any suggestions or solutions to this frustrating problem!???
Thanks all who reads.
Christian
View Replies !
View Related
If Statement Only Working For First Conditional
I am making a transition content system, where by clicking on the navigation, it checks what section is currently active, fades that section out, before bringing in the section being clicked on. However, on my navigation, there is something that doens't makes sense. Here is my code:
nav1_mc.onRelease = function() {
if (_root.section=1) {
_root.content_mc.gotoAndPlay(3);
_root.section = 1;
_root.entering = 10;
} else if (_root.section=2) {
_root.content_mc.gotoAndPlay(5);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=3) {
_root.content_mc.gotoAndPlay(7);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=4) {
_root.content_mc.gotoAndPlay(9);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=5) {
_root.content_mc.gotoAndPlay(11);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=6) {
_root.content_mc.gotoAndPlay(13);
_root.entering = 10;
_root.section = 1;
}
};
This is on all 6 buttons, with of course the nav1 changed to nav(x) and the section being set accordingly to what button was pressed. Now I am tracing my _root.section variable, and it is getting changed. For example, when you click on button 5, it changes the section to 5, just like it should, and my trace varifies this. But then, each time I click on any button, it fades out the section 1 content, as though _root.section=1 were always true! I have no idea why this is happening. Why is only the first conditional being accepted here, and no matter what the actual _root.section variable, it is always performing the actions of the first "if" variable!
View Replies !
View Related
If Statement Not Working[mx04]
Hi,
Could someone please tell me what I'm doing wrong with this if statement, coz it just keeps getting passed through when it should function
Code:
if (myXMLs.firstChild.childNodes==null){
this.attachMovie(myItem2, sorry, 200);
thisItem2._X = myX;
thisItem2._Y = myY+=(thisItem2._height);
break;
Thanks in advance.
View Replies !
View Related
Nested If Statement Working In FP6 Not FP7/8
I'm having trouble to get the following code to work in Flash Player 7 or 8. It works fine in 6 though. I think it is something to do with the nested If statement. Any help would be greatly appreciated.
By the way I need it to work in FP8 because I will be adding some functionality that requires this.
Oh, I am using Adobe Flash CS3
Many thanks
Hamish
loadMovie("images/1.jpg", "image");
// resize actions//
var stuff = new Object();
// add an 'onResize' method to our custom object.
stuff.onResize = function() {
stretchIt();
};
// the function that actually does the stretching..
function stretchIt() {
if (stage.width<1440 || stage.height<1080) {
if (stage.height>(.75*stage.width)) {
image._width = Stage.height/.75;
image._height = Stage.height;
image._x = 0-(0.5*(Stage.height/.75))+(0.5*stage.width);
image._y = 0;
} else {
image._width = Stage.width;
image._height = Stage.width*.75;
image._x = 0;
image._y = 0-(0.5*(Stage.width*.75))+(0.5*stage.height);
}
} else {
image._width = 1440;
image._height = 1080;
image._x = .5*Stage.width-(.5*1440);
image._y = .5*Stage.height-(.5*1080);
}
}
// set the scalemode property so that nothing 'auto-scales'
Stage.scaleMode = "noScale";
// set the align property so that everything aligns to the upper left
Stage.align = "tl";
// register our custom object with the Stage object.
Stage.addListener(stuff);
// stretch the clip when we init
stretchIt();
stop();
View Replies !
View Related
If/Else Statement On A Button, Else Not Working
Hey all, once again another very simple problem which has the potential to drive me completely loopy!!
Here's the code
PHP Code:
on(release){
if(mainBulk.one.frame==1){
mainBulk.one.gotoAndPlay(1);
lineOne.gotoAndPlay(16);
lineOne._visible=false;
}else{
mainBulk.one.gotoAndPlay(16);
lineOne._visible=true;
}
}
Basically (I know its bad practise to put the code on the button but it's just what I've done this time around) the if statement seems to work absolutely fine, but for some reason the else statement doesnt work!! I even tried it with else if, but still that doesnt work!! Any ideas?
Cheers
View Replies !
View Related
[F8]IF Statement Not Working Correctly ?
Hi guys im not sure whats going on here??
But the basics users clicks register it sends information to PHP page , PHP page returns a value either OK or RegError and depending on the retrieved value output a message.I have been rattling my brains for the past 3 hours trying to see where the problem is but for the life of me i cant see it :S
NOTE : I have block commented the functions in the hope it will help some people read the sections in the code.
Sorry for the long posts here guys but i thought i should post all my AS code for you guys to check.
BTW crms.no-ip.info is a locally hosted domain , So if my computer isnt on you wont be able to access that address, Just thought i should let you guys know.
Here is the AS code
Code:
stop();
_global.LoginScript;
_global.LoginScript = "http://crms.no-ip.info/flash/functions/login.php";
loginTxt.text = "";
///////////LOGIN SCRIPT CURRENTLY WORKING///////////////////////////////////
varReceiver = new LoadVars();
var AttemptCounter:Number = 0;
myBtn_btn.onRelease = function() {
ConnectionInfo.addItem("Attempting Login");
varReceiver.Age = age.selectedIndex+1;
varReceiver.Action = "ProcessLogin";
varReceiver.Username = username.text;
varReceiver.Userpassword = userpass.text;
varReceiver.sendAndLoad(_global.LoginScript,varReceiver,"POST");
loginTxt.text = "Processing Variables";
varReceiver.onLoad = function(){
//errormsg.text = this.login;
myTrace.text = unescape(this);
_global.UserCheck;
_global.UserCheck= this.login;
ConnectionInfo.addItem("Login Authorisation is : "+this.login);
AttemptCounter++;
LoginAttempts.text = "Logins Attempted "+AttemptCounter;
if(this.login == "YES"){
gotoAndPlay(10);
}else{
username.text = "";
userpass.text = "";
loginTxt.text = ("Your details could not be found, " +newline+ " Please either register yourself or " +newline+ "choose forgotten password.");
}
}
}
///////END LOGIN SCRIPT///////////////////////
///START NEW USER REGISTRATION CURRENTLY NOT WORKING PROPERLY//////////////////
varNewUser = new LoadVars();
register.onRelease = function() {
ConnectionInfo.addItem("Sending Registration Request");
varNewUser.Action = "ProcessRegister";
varNewUser.Username = username.text;
varNewUser.Userpassword = userpass.text;
varNewUser.sendAndLoad(_global.LoginScript,varNewUser,"POST");
//trace(varNewUser);
//getURL(_global.LoginScript);
varNewUser.onLoad = function(){
ConnectionInfo.addItem("Received response from Server");
ConnectionInfo.addItem ("Server Responded: "+this.newusers);
if(this.newusers == "OK"){
username.text = "";
userpass.text = "";
loginTxt.text = ("Registration Success"+newline+"Please proceed to login.");
}else{
trace("Entered Error");
trace("Value returned by server is "+this.newusers);
username.text = "";
userpass.text = "";
loginTxt.text = ("We were unable to process your registration this time");
}
}//End OnLoad function
}//end onRelease of register
//END NEW USER REGISTRATION/////////////////////////////////
The PHP code :
PHP Code:
$Username = ucfirst($_POST['Username']);$Userpassword = md5($_POST['Userpassword']);$Action = $_POST['Action'];$login = "";//What is the user trying to do ? switch($Action){case "ProcessLogin"://Search for user in DB $sql = ("SELECT * FROM `users` WHERE `Username` = '".$Username."' AND `Userspassword` = '".$Userpassword."'");$query = mysql_query($sql); $result = mysql_fetch_array($query); if($result == ""){ $login = "NO"; echo ("&login=$login"); }else{ //write back to flash YES user is registered $login = "YES"; echo ("&login=$login&"); /////// }//break;case "ProcessRegister": $sql = "INSERT INTO `users` (`Username`,`UsersPassword`) VALUES ('".$Username."', '".$Userpassword."')"; echo "The value of SQL is <br>".$sql."<br> END SQL <br>"; $query = mysql_query($sql); if (!$query){ $login = "RegError"; echo ("&newusers=$login"); }else{ $login = "OK"; echo ("&newusers=$login"); }break;}
Now as you can see the PHP contains a switch to find out what the user wants to do either login or register and perform the relevant switch statement
Now what is puzzling me is that the this.newusers is always ok , I mean it inserts new data into the database but it doesnt display the ok message always says we cant process your registration in the flash window even though the insert worked fine :S Even when i "trace" this.newusers into the connection info listbox control it says Server Responded : OK So why is flash completely ignoring that and displaying the error message instead ?
The problem code i believe is this
Code:
if(this.newusers == "OK"){
username.text = "";
userpass.text = "";
loginTxt.text = ("Registration Success"+newline+"Please proceed to login.");
}else{
trace("Entered Error");
trace("Value returned by server is "+this.newusers);
username.text = "";
userpass.text = "";
loginTxt.text = ("We were unable to process your registration this time");
}
Once this is fully working i will comment it out and upload it as a Zip file in the tutorials section as a help me for people new to flash like myself. In the hope that others can benefit from it , Just need to get it working properly first lol.
Sorry for the epic post again guys and a BIG thank you for who ever takes the time out to read it.
View Replies !
View Related
Case Statement Not Working
Code:
volCalc = Math.round(((_root.bottomBar.volumeMc.volDrag._x)*100)/54);
audio.setVolume(volCalc);
switch (Number(volCalc)) {
case volCalc>78 :
_root.bottomBar.muteMc.gotoAndStop(1);
break;
case volCalc>58 :
_root.bottomBar.muteMc.gotoAndStop(2);
break;
case volCalc>38 :
_root.bottomBar.muteMc.gotoAndStop(3);
break;
case volCalc>18 :
_root.bottomBar.muteMc.gotoAndStop(4);
break;
default :
_root.bottomBar.muteMc.gotoAndStop(5);
break;
}
That is within an on eneter frame of an mc.
volCalc is a value between 0 and 100
I dont see why this does not work
Can anyone help me out?
I appriciate your time
~Gabor
View Replies !
View Related
IF Statement Not Working As Expected
Code:
for (i=0;i<12;i++){
if ( string1[i].MC._rotation==0 && ( _global.shootInstance != _root["sphere1"+i].sphereInstance ) ){
trace( _root["sphere1"+i].sphereInstance );
trace( _global.shootInstance );
trace( "different" );
}
The array string1 has 12 entries with each a different _rotation value. One of them is always zero.
sphereInstance and shootInstance are integers which can either be 1, 2 or 3.
When (string1[i].MC._rotation==0)==true the if script ALWAYS executes no matter what the second parameter gives. Many times the traces reveal that the two values are equal.
When I change the != to == the script never executes
This certainly got me puzzled :S
View Replies !
View Related
For Statement And AddChild Not Working Together
I've been working all morning to get this "for" statement all morning and I'm about ready to forswear AS3 forever. In AS2 this would be horribly simple, I'm pulling a movie clip out of my library (I'd just use duplicate normally but Adobe, in their wisdom, removed it) and then trying to set a couple properties. Now when I do this just once with no extra messing about it works fine.
Here's my working code:
ActionScript Code:
var myClip:testClip = new testClip();
this.addChild(myClip);
this.myClip.x=20;
this.myClip.y=20;
this.myClip.alpha=0.5;
So, I thought, if I can do that so easily of course I can add a for statement and automate the creation of 10 clips, or however many I happen to have. Seems reasonable, right? Apparently not.
Normally, in good ol' AS2, I'd have done something like this:
ActionScript Code:
for (var i:Number = 0; i < 10; i++) {
var ["myClip"+i]:testClip = new testClip();
this.addChild(["myClip"+i]);
this["myClip"+i].x=20;
this["myClip"+i].y=20;
this["myClip"+i].alpha=0.5;
}
However, this doesn't work. And I can't find an example of anything anywhere that tells me how to make it work. Can someone tell me what Adobe has brilliantly done to make this part of the process easier?
View Replies !
View Related
Trace Statement Not Working
OK I have no idea whats going on, I can't get anything to work properly right now. I'm kinda new to this so If i'm missing something obvious please forgive me.
In an effort to simplify things I wrote the most basic script I could and it is NOT working,,, by that I mean I'm not getting the "trace statement" I'm not getting any errors either...
Here is the code I have PLEASE HELP !
(I have an FLA File named "landingPage" and an AS file named "main" the AS is in a sub folder named 'src' and the document class for "landingPage" is "src.main". All I want here is a simple trace statement to make sure I am starting on the right foot.....)
ActionScript Code:
package src
{
import flash.display.MovieClip;
public class main extends MovieClip
{
public function Main()
{
trace("working");
}
}
}
View Replies !
View Related
Conditional Statement Not Working?
Hi All,
In the code below i can't seem to get the second conditional statement to work.
Any Ideas?
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
if (this._droptarget == "/box9") {
_root.corSound.start();
_root.count = _root.count+1;
_root.cnt = _root.count;
this._visible = false;}
tellTarget ("/box9") {
gotoAndStop("pic");
_alpha = 100;
}
if (_root.count == 10 && sisaSec >20){
tellTarget ("/") {gotoAndStop(4)
}
}
else if(_root.count == 10 && sisaSec <20){
tellTarget ("/") {gotoAndStop(3)
}
}
}
View Replies !
View Related
IF Statement Not Working. Seems Simple....
Hi
I'm building a Flash app with Flash and mProjector, but this is code related, and not caused by mProjector. (90% sure )
Anyway, my App is setup like this so far:
1. Open app, form appears. (works)
2. User fills out form, clicks on a button to save form results to XML file on local Hard Drive. Checkboxes are present.
A listener object sits in the background and updates a Text field with the checkboxes status.
The Text fields value is written to the XML file. (works)
3. User presses a button to clear form fields. (works)
4. User clicks open document, navigates to saved XML file and opens it. (works)
5. XML is loaded into Flash. Form fields are filled out. (works)
6. The two Checkboxes, based on two If Statements and the contents of the XML file, are told to be selected, or unselected. (Doesn't work)
Heres the code for the IF Statements:
Code:
if (data_xml.firstChild.childNodes[3].firstChild == "1") {
check_email.selected = true;
} else if (data_xml.firstChild.childNodes[3].firstChild == "0") {
check_email.selected = false;
}
if (data_xml.firstChild.childNodes[4].firstChild = "yes") {
check_fax.selected = true;
} else if (data_xml.firstChild.childNodes[4].firstChild = "no") {
check_fax.selected = false;
}
A **Trace of:
Code:
"data_xml.firstChild.childNodes[3].firstChild = " + data_xml.firstChild.childNodes[3].firstChild;
Produces: data_xml.firstChild.childNodes[3].firstChild = 1
** Not real trace. Flashes built-in tracer is out of reach once the Swf is compiled into a mProjector app, and I couldn't get mProjectors Traceviewer to work for me, so I'm sending my trace commands to a dynamic text field. Seems to work.
Which confuses me, the Value is obviously "1" the xml file says so, the app says so once its imported. But the If Statement doesn't care.
If I use "=" in the IF statement, the checkbox is told to be selected, no matter what the loaded XML file says.
If I use "==" in the IF statement, then the checkbox is told to be unselected no matter what the XML file says. (Or is just unresponsive in general. I:E not unselecting it if it was selected on XML load)
Soooo..... What kind of mindlessly simple thing am i missing here?
I really didn't expect bugs from this. Bugs yes, but not from this bit of code.
Since all I have to do is change the code back and forth between "=" and "==" to get the checkboxes to change behavior, I'm positive the problem doesn't lie in something like variable or instance names.
I get no errors when I check the code in Flash, and I can't find any loose bits of code or typos that could be the problem.
Any suggestions?
Thanks
- Lem
View Replies !
View Related
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
View Replies !
View Related
|