If statements

I heve this code:


_root.my.myw_b.onRelease = function() {
	if (yoyo = "1") {
		_root.sub_work.sub_work1.onEnterFrame = function() {
			this.nextFrame();}
		_root.sub_work.sub_work2.onEnterFrame = function() {
			this.nextFrame();}
		_root.sub_work.sub_work3.onEnterFrame = function() {
			this.nextFrame();}
		}
	 else {	
	
		_root.sub_just.sub_just_1.onEnterFrame = function() {
			this.prevFrame();}
		_root.sub_just.sub_just_2.onEnterFrame = function() {
			this.prevFrame();}
	}
};

what i need:

else statement work fine but in frame 1 of _root.sub_just.sub_just_1 i set the variable yoyo = 1; and I need to execute the if code only when _root.sub_just.sub_just_1 arrive at frame 1.

I need help :{

if (yoyo = "1") {

Should be

if (yoyo == 1) {

How can I set the variable in _root.sub_just.sub_just_1.
I trace yoyo in the main timeline (undefined).

10x