# Using an addEventListener with an If statement?

**URL:** <https://forum.kirupa.com/t/using-an-addeventlistener-with-an-if-statement/256954>\
**Category:** flash\
**Created:** [April 9, 2008, 2:29am UTC](https://forum.kirupa.com/t/using-an-addeventlistener-with-an-if-statement/256954 "2008-04-09T02:29:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![koltz](https://avatars.discourse-cdn.com/v4/letter/k/6bbea6/32.png) [@koltz](https://forum.kirupa.com/u/koltz)\
**Post date:** [April 9, 2008, 2:29am UTC](https://forum.kirupa.com/t/using-an-addeventlistener-with-an-if-statement/256954/1 "2008-04-09T02:29:04Z")

</div>

I am pulling XML, but the sometimes the URL that it pulls to get the image, doesn’t actually link to an image. So it seems to always pull a URL from the XML though no image loads and I get the following error after displaying the Flash program “Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.” Can I do a If Statement with an addEventListener, if succesful loads one line of code, if it fails, then loads another?

thanks,

Corey
