If loop not working. Help!

>I am attaching a link to my .fla as well<

When you open up the .swf, click on the “go to store button” once it has loaded up. From there, click on the “Flags” button.

When that is open, you will see 2 MC’s in the box there. What I’m trying to do is have an if statement that checks to see if any other decal is being used at the moment.


_parent.decal

that is just a variable that I have defined to hold a value. It has no refrence to a MC.

In MC #1 I have


onClipEvent (mouseDown) {
	if (_parent.decal == 2){
		_parent.gotoAndPlay ("flagMenu");
		} else {
	if (this.hitTest(_root._xmouse, _root._ymouse)) {
		this.startDrag();
	}
		}
}
onClipEvent (mouseUp) {
	if (this.hitTest(_root._xmouse, _root._ymouse)) {
	this.stopDrag();
	_parent.decal = 1;
	}
}

on MC #2 I have


onClipEvent (mouseDown) {
	if (_parent.decal == 1){
		_parent.gotoAndPlay ("flagMenu");
		} else {
	if (this.hitTest(_root._xmouse, _root._ymouse)) {
		this.startDrag();
	}
		}
}
onClipEvent (mouseUp) {
	if (this.hitTest(_root._xmouse, _root._ymouse)) {
	this.stopDrag();
	_parent.decal = 2;
	}
}

The frame “flagMenu” is 2 frames before the decals. The frame before the decals has :


_parent.decal = 0;

What is supposed to happen is that when I pick up decal #1, I can move it freely about. When I let go of it, I can pick it back up if I want to. When I go to click on Decal #2, it should recognize that Decal #1 has been moved, and reset both of their locations by going back a frame, and starting over in their original positions. For the life of me, I can not get this to work. Any help is much appriciated. Thank You!!!

>link to .fla<
http://www.users.qwest.net/~danno/Graphix3.fla

I think what’s wrong is your else if statement. You’ve got the else and if separated by a curly bracket. They shouldn’t be. Try something like this…


on (release) {
  if (condition1) {
    code for condition goes in here
  } else if (condition2) {
    code for condition goes in here
  }
}

Nope… didn’t make any difference.
Test out my .fla to see what i’m talking about.

Wahoo! I figured it out!

I do appriciate the help. Thanks though.

If you want to know what happened, I can tell ya, but till then!

:slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: