# Big "IF" statement problem!

**URL:** <https://forum.kirupa.com/t/big-if-statement-problem/292007>\
**Category:** flash\
**Created:** [July 8, 2009, 11:09pm UTC](https://forum.kirupa.com/t/big-if-statement-problem/292007 "2009-07-08T23:09:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crmoberg](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@crmoberg](https://forum.kirupa.com/u/crmoberg)\
**Post date:** [July 8, 2009, 11:09pm UTC](https://forum.kirupa.com/t/big-if-statement-problem/292007/1 "2009-07-08T23:09:15Z")

</div>

At least I thinks its the if statement. I have an FLV Playback Component and three buttons. The buttons change the source of the FLV Playback. It was working fine. When I added an ‘if’ statement to track what video was currently being played I now get an error that goes on and on forever. This is the code I had working before adding the ‘if’ statement.

```auto
my_FLVPlybk.source = "think_eng.flv";
my_FLVPlybk.addASCuePoint(3, "1st_switch");
my_FLVPlybk.width = 640;
my_FLVPlybk.height = 426;

my_FLVPlybk.addEventListener(VideoEvent.READY, ready_listener);
my_FLVPlybk.addEventListener(VideoEvent.BUFFERING_STATE_ENTERED, videoStart)
my_FLVPlybk.addEventListener(VideoEvent.COMPLETE, videoDone)
function videoStart(eventObject:VideoEvent) 
{
	my_FLVPlybk.visible = true;
	video1Main_mc.rectangle1_mc.x = -8.4;
	video1Main_mc.rectangle1_mc.alpha = 1;
	video1_btn.visible = false;
}
function videoDone(eventObject:VideoEvent)
{
	my_FLVPlybk.visible = false;
	video1Main_mc.rectangle1_mc.x = -161.4;
	video1Main_mc.rectangle1_mc.alpha = 0;
	video1_btn.visible = true;
}
function ready_listener(eventObject:VideoEvent)
{
	my_FLVPlybk.activeVideoPlayerIndex = 1;
    my_FLVPlybk.source = "tech_eng.flv";
    my_FLVPlybk.addASCuePoint(3, "2nd_switch");
    my_FLVPlybk.activeVideoPlayerIndex = 0;
	
	my_FLVPlybk.activeVideoPlayerIndex = 2;
    my_FLVPlybk.source = "people_eng.flv";
    my_FLVPlybk.addASCuePoint(3, "2nd_switch");
    my_FLVPlybk.activeVideoPlayerIndex = 0;
}

```

Then I added this after the ready\_listener.

```auto
if (my_FLVPlybk.source == "think_eng.flv")
	{
		video1Main_mc.rectangle1_mc.x = -8.4;
		video1Main_mc.rectangle1_mc.alpha = 1;
		video1_btn.visible = false;
	}
	
	if (my_FLVPlybk.source == "tech_eng.flv")
	{
		video1Main_mc.rectangle1_mc.x = -161.4;
		video1Main_mc.rectangle1_mc.alpha = 0;
		video1_btn.visible = true;
	}
	
	if (my_FLVPlybk.source == "people_eng.flv")
	{
		video1Main_mc.rectangle1_mc.x = -161.4;
		video1Main_mc.rectangle1_mc.alpha = 0;
		video1_btn.visible = true;
	}

```

Now I get this Error. The never ending one, it just keeps repeating.

> TypeError: Error #1010: A term is undefined and has no properties.  
> at MethodInfo-680()  
> at flash.events::EventDispatcher/dispatchEventFunction()  
> at flash.events::EventDispatcher/dispatchEvent()  
> at fl.video::FLVPlayback/[http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()](http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent())  
> at flash.events::EventDispatcher/dispatchEventFunction()  
> at flash.events::EventDispatcher/dispatchEvent()  
> at fl.video::VideoPlayer/[http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime()](http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime())  
> at flash.utils::Timer/\_timerDispatch()  
> at flash.utils::Timer/tick()

Any help is much appreciated. I’m still new to AS3 so I’m not sure if it’s something really simple that I am doing wrong or complicated.

Thanks!
