# Problem with if statement

**URL:** <https://forum.kirupa.com/t/problem-with-if-statement/185453>\
**Category:** Uncategorized\
**Created:** [April 13, 2006, 2:19pm UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453 "2006-04-13T14:19:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [April 13, 2006, 2:19pm UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453/1 "2006-04-13T14:19:21Z")

</div>

hey all!  
I have a sliding menu and what i want is when i click a button the slider has to reach a certain point and then a preloader starts… i used a preloader from senocular. Below is the complete code my problem is in the first few lines. Maybe somebody can help me??

```auto

onEnterFrame = function() {
 trace(pijl._y)
 
if (pijl._y != 233.55) {
 
 startPreload("about/about.swf");
 }

// this function begins preloading a swf url
function startPreload(url){

 // use loadMovie to load the swf url into container_mc
 container_mc.loadMovie(url);
 // attach the preloader animation
 // this will be removed when preloading is complete
 attachMovie("preloader_external", "preloader_mc", 100, {_x:124, _y:214});
 
 // set the onEnterFrame event to call preloadContainer
 
 onEnterFrame = preloadContainer;
}

// this function runs the preloader
// it is to be used with the onEnterFrame
// of the preloader animation
function preloadContainer(){
 
 // get bytes loaded and total from container_mc
 var bytes_loaded = container_mc.getBytesLoaded();
 var bytes_total = container_mc.getBytesTotal();
 
 
 // stop and hide the movie so it wont play or
 // be seen while progressively downloading
 // (keep trying if it exists or not just to be sure)
 container_mc.stop();
 container_mc._visible = false;
 
 // if bytes_total is a valid number and greater than 0
 if (bytes_total > 0){
  
  // get percent loaded
  var percent_loaded = bytes_loaded/bytes_total;
  
  // update the value in the preloader
  preloader_mc.value = percent_loaded;
   
  // check if preloading is complete
  if (percent_loaded == 1){
   
   // play and show the container clip
   
   container_mc.play();
   container_mc._visible = true;

   // remove the preloader movie clip
   preloader_mc.removeMovieClip();
   
   // delete the onEnterFrame event handler running this function
   delete onEnterFrame;
  }
 }
}
}

```

---

<div class="post-metadata">

**Author:** ![flextnet](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@flextnet](https://forum.kirupa.com/u/flextnet)\
**Post date:** [April 13, 2006, 2:47pm UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453/2 "2006-04-13T14:47:28Z")

</div>

Hi- can you explain what is going wrong? Is the startPreload() function not being called?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 13, 2006, 2:55pm UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453/3 "2006-04-13T14:55:32Z")

</div>

have you tried:

```auto
onEnterFrame = function() {
 trace(pijl._y)
 
if (pijl._y == 233.55) {
   startPreload("about/about.swf");
}

```

---

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [April 13, 2006, 4:13pm UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453/4 "2006-04-13T16:13:06Z")

</div>

@defective: yes i tried that

@flextnet: yes that function isnt called. If i change the startPreload command to the actual container\_mc.loadmovie(“about/about.swf”) then the if command works…

---

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [April 14, 2006, 6:22am UTC](https://forum.kirupa.com/t/problem-with-if-statement/185453/5 "2006-04-14T06:22:28Z")

</div>

solved… so this thread can be closed!
