# Stuck in a loop

**URL:** https://forum.kirupa.com/t/stuck-in-a-loop/280282
**Category:** flash
**Created:** [January 25, 2009, 5:27pm UTC](https://forum.kirupa.com/t/stuck-in-a-loop/280282 "2009-01-25T17:27:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imcabee](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@imcabee](https://forum.kirupa.com/u/imcabee)
#### Post date: [January 25, 2009, 5:27pm UTC](https://forum.kirupa.com/t/stuck-in-a-loop/280282/1 "2009-01-25T17:27:23Z")

</div>

Hello,  
I am a AS 3 newbie…I have a swf within a html page. There is a function that opens an html page when an object gets to a certain x position. However, when the object gets to that point the new html page (in \_self) opens over and over again and get stuck in a loop. Any way to escape this loop and what would be the best way to trigger this new html page to open when the x position of the object is true?

Code:  
a\_mc.addEventListener(Event.ENTER\_FRAME, stop\_a);  
function stop\_a(event:Event):void  
{  
if(a\_mc.x\<71 && a\_mc.x\>69)  
{  
navigateToURL(new URLRequest(“[http://test.scheiner.com/advertising.html"),"\_self](http://test.scheiner.com/advertising.html%22),%22_self)”);  
}

Thanks in advance!
