I made 2 variables at a certain point in the timeline
var photo1=1
var photo2=2
Then after a button is clicked:
if (photo1=1) {
_parent.photo1.gotoAndPlay("reduce");
}
That works fine, but the moment I add the second part:
if (photo1=1) {
_parent.photo1.gotoAndPlay("reduce");
}
if (photo2=2) {
_parent.photo2.gotoAndPlay("reduce");
}
it all breaks. Why is that? I have tried using "==" too and that didnt help.
Thanks
Dan
Dont know what I could be doing wrong. I attached the fla. I just need it to check if any other images (I used numbers here) are open when clicked and to close them automatically. thanks
If you look into your ouput for variables, you'll find this: _level0.instance1.photo1.photo1 which is the full path of the variable photo1.
So not only should you change the equality sign to a double in the if statements, but you should also give an instance name to that 'instance1' (default name used by flash for symbols that miss an instance name) and when trying to reference the variable 'photo1' make sure to use either the correct relative path or the correct absolute path.
Ah, I see. That didnt help though. I named it "photos" and used:if (_root.photos.photo1==1) {
_root.photos.photo1.gotoAndPlay("reduce");
}
if (_root.photos.photo1==2) {
_root.photos.photo2.gotoAndPlay("reduce");
}