# Flash Preloader in AS3 issue

**URL:** <https://forum.kirupa.com/t/flash-preloader-in-as3-issue/300147>\
**Category:** flash\
**Created:** [November 16, 2009, 9:51pm UTC](https://forum.kirupa.com/t/flash-preloader-in-as3-issue/300147 "2009-11-16T21:51:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thevibe](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@thevibe](https://forum.kirupa.com/u/thevibe)\
**Post date:** [November 16, 2009, 9:51pm UTC](https://forum.kirupa.com/t/flash-preloader-in-as3-issue/300147/1 "2009-11-16T21:51:47Z")

</div>

Hi guys,

I am designing a website with html pages and flash pages. When the user open a flash page (embedded in an html page) i would want to have a preload script. I found a couple of them but they all need to start at the first frame and have a go to and play script after. So my problem is that I already have an important script that make a image follow my mouse and the script needs to be on the first frame to. Is there any way to have both or maybe to have the preloader on a separate file or even change the way my script is written ?

I am open to any ideas, here’s the script I already need;

addEventListener(Event.ENTER\_FRAME, loopX);  
addEventListener(Event.ENTER\_FRAME, loopY);

function loopX(e:Event):void  
{  
var xDist:Number = mouseX - stage.stageWidth \* 0.5

```
if((karate.rotationY - (xDist * 0.001) &gt;-3)&&(karate.rotationY - (xDist * 0.001) &lt;6))

karate.rotationY -= xDist * 0.0002;

else

karate.rotationY -= xDist * 0.000;

```

}

function loopY(e:Event):void  
{  
var yDist:Number = mouseY - stage.stageHeight \* 0.5

```
if((karate.rotationX - (yDist * -0.0005) &gt;-5)&&(karate.rotationX - (yDist * -0.0005 ) &lt;3))

karate.rotationX -= yDist * -0.0002;

else

karate.rotationX -= yDist * 0.000;

```

}

Thanks guys
