PDA

View Full Version : Trying to play a movie with an if statement


eggzie
03-09-2006, 05:56 PM
if((_root.lastCoinPlayed == 1) and (_root.pos1==_root.pos2) and (_root.buttonpress1==true) and (_root.buttonpress2==true))
{
_root.msgroot=1
}

if(_root.msgroot==1){
_root.win_mc.gotoAndPlay(1);
}

Im trying to build a simple slot machine for my actionscript class and i've got all my variables in my main timeline and when i try to play my win animation with the conditions that i set= (reels match, have been stopped by pressing the reel buttons, and the 1 coin played), the movie wont play.

Ive tested all the conditions with trace, but the movie wont play within the if statement.

What is going on wrong?

Any help is appreciated

Cota
03-09-2006, 06:03 PM
Have you double checked your instance names?

eggzie
03-09-2006, 06:06 PM
yeah, cause

on(release){
_root.win_mc.gotoAndPlay(1);

}

i just dont get why it wont play within the if.

Cota
03-09-2006, 06:12 PM
if((_root.lastCoinPlayed == 1) && (_root.pos1==_root.pos2) &&(_root.buttonpress1==true) && (_root.buttonpress2==true))
{
_root.msgroot=1
trace("Set msgroot to 1");
}

if(_root.msgroot==1){
_root.win_mc.gotoAndPlay(1);
trace("Movie Should Play");
}


use that and tell me what traces you get..

eggzie
03-09-2006, 06:14 PM
Set msgroot to 1
Movie Should Play

the traces were displayed but the movie did not play.

I also moved the gotoandplay outside of the if and clicked the button and the movie played perfectly.

I'm so confused at this point.
Thanks for your quick help so far, but It still isnt working. :(

Cota
03-09-2006, 06:20 PM
This is truly an odd situation...could you upload your FLA

eggzie
03-09-2006, 06:23 PM
sure. its a bit messy. im learning.

the blue button at the top left corner is my test for playing the movie.
you have to 'feed' the monster the '1' spaceship and pull his arm. the first two reels have to match for the test button to work.

Cota
03-09-2006, 06:30 PM
I'm assuming the movie you want to play is the rocket that goes from bottom to top?

eggzie
03-09-2006, 06:58 PM
yeah.

Cota
03-09-2006, 07:20 PM
It works for me...

eggzie
03-09-2006, 07:22 PM
are you serious?? Thanks anyway. back to the drawing board. Thanks again Cota.

gogole
03-17-2006, 08:48 PM
i,ll test it and see

eggzie
03-23-2006, 08:42 PM
Let me know if you find anything, I still cant get it to work right