Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : If statement not workin?


highlander_1
1/9/2005 9:15:53 PM
Here I?m trying to build a If statement for a small navigation.

I have 4 movies.swf at 4 levels.
On level0 there?s a backgroundSound playing (mySound1)

I have movieClip "buttons" thats start mySound4 and mySound5 onRollOver and
onRollOut
in "myFourthMovie.swf", on level4.

Here?s the strange thing thats happends:

a. onRollOver everything is ok
b. onPress ? nothings happens
c. onRollOut ? mc1 disappear and mySound4 is playing uninterruptedly

Im only want mySound4 to stop and start mySound5 at the same time as
a new popUp i displaying on the screen.

1. THE CODE IN THE FIRST FRAME in myFourthMovie.swf on level4 :

stop();
mySound4 = new Sound(this.SoundPlaceholder4);
mySound5 = new Sound(this.SoundPlaceholder5);
mySound4.attachSound("field");
mySound5.attachSound("fadeout");

_root.mc1.onRollOver = function(){
_root.mc1.mc2.gotoAndPlay(2);
mySound4.start(0, 0);
};

_root.mc1.onRollOut = function() {
_root.mc1.mc2.gotoAndPlay("fade");
mySound4.stop();
mySound5.start(0, 0);
};


2. THE CODE IN THE "FADE" FRAME (frame 92)
if (fadeout = true) {
//PopUp shovs a short animation before a new movie loads
//in the main timeline
_root.McBeginLoad.play();
//Sets mc1 to "invisible" and hide the mc1 below PopUp
_root.kund1.gotoAndStop(2);
}

:-)

/Now I?m tired and confused
highlander_1
1/9/2005 10:18:09 PM
Thanks!!! for your answer!! :-)

(But it didn?t work.)

highlander_1
1/10/2005 4:07:28 AM
::oOuups, sorry did not cut and past all the code.
I was so tired.

Here is the completed code:

1. THE CODE IN THE FIRST FRAME in myFourthMovie.swf on level4 :

stop();
mySound4 = new Sound(this.SoundPlaceholder4);
mySound5 = new Sound(this.SoundPlaceholder5);
mySound4.attachSound("field");
mySound5.attachSound("fadeout");

_root.mc1.onRollOver = function(){
_root.mc1.mc2.gotoAndPlay(2);
mySound4.start(0, 0);
};

_root.mc1.onRollOut = function() {
_root.mc1.mc2.gotoAndPlay("fade");
mySound4.stop();
mySound5.start(0, 0);
};
//The missing part of the code
_root.mc1.onPress = function() {
mySound4 = fadeout;
fadeout = true;
_root.mc1.mc2.gotoAndPlay("fade");
};



2. THE CODE IN THE "FADE" FRAME (frame 92)
if (fadeout== true) {
//PopUp shovs a short animation before a new movie loads
//in the main timeline
_root.McBeginLoad.play();
//Sets mc1 to "invisible" and hide the mc1 below PopUp
_root.kund1.gotoAndStop(2);
}


Jeckyl
1/10/2005 8:51:42 AM
[quoted text, click to view]

should be

if (fadeout == true) {

or better still

if (fadeout) {

Jeckyl

Jeckyl
1/10/2005 10:16:56 AM
then you've stuffed up somewhere else as well ... For a start, look for
other places you've use '=' instead of '==' (and vice versa)

its hard to tell from what you've shown exactly what you've done wrong.
--
All the best,
Jeckyl
[quoted text, click to view]

Jeckyl
1/10/2005 10:18:03 AM
btw: I see no code where 'fadeout' is set (to true or false or anything
else). So it will be undefined. Sounds like you've not shown all your
code, or your code is not yet complete.
--
All the best,
Jeckyl

highlander_1
1/10/2005 11:24:25 AM
Thanks
Sorry I?m insecure - its my first If-statement:o
But I?m gonna change that and control all of my code with tracert.
Jeckyl
1/10/2005 3:51:26 PM
what on earth are you trying to do here...

mySound4 = fadeout;
fadeout = true;

mySound is a sound, and fadeout is a true/fals value .. what assign a
true/false value to something that is supposed to be a sound?

It sounds ( :-) ) like you are a bit confused in your coding or your naming
of things.
--
All the best,
Jeckyl

AddThis Social Bookmark Button