# Preload scipt and theClip.play()

**URL:** <https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685>\
**Category:** flash\
**Created:** [July 25, 2002, 6:23pm UTC](https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685 "2002-07-25T18:23:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![3dron](https://avatars.discourse-cdn.com/v4/letter/3/2acd7d/32.png) [@3dron](https://forum.kirupa.com/u/3dron)\
**Post date:** [July 25, 2002, 6:23pm UTC](https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685/1 "2002-07-25T18:23:48Z")

</div>

I am using the preloader code:

host.loadMovie(“hwtp\_main.swf”);  
function preload(theClip) {  
if (!theClip.doneLoading) {  
if (theClip.\_framesloaded\>0 && theClip.\_framesloaded == theClip.\_totalframes) {  
gotoAndPlay(“Enter”);  
} else {  
theClip.stop();  
}  
bytesLoadedOutput = theClip.getBytesLoaded();  
bytesTotalOutput = theClip.getBytesTotal();  
var percentLoaded = (theClip.getBytesLoaded()/theClip.getBytesTotal());  
LoadMask.\_width = 150\*percentLoaded;  
}  
}

Script works fine and goes to framelabel “Enter” after swf has loaded. But then I have a button appear and I want to:

theClip.play()

Why won’t the clip start?

theClip.play() works if it replaces gotoAndPlay(“Enter”) in the script above

Please help!!!

RR

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2002, 8:10pm UTC](https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685/2 "2002-07-25T20:10:22Z")

</div>

Wrong target. theClip is no longer your clip (it’s just a name that you put as a parameter). You have to do

```auto
on (press) {
_root.host.play();
}

```

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2002, 8:18pm UTC](https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685/3 "2002-07-25T20:18:54Z")

</div>

Thanks for all your help!

You have been answering quite a few of my posts. Your help is greatly appreciated.

I may have to put you on my payroll.

Ron R

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2002, 8:34pm UTC](https://forum.kirupa.com/t/preload-scipt-and-theclip-play/685/4 "2002-07-25T20:34:19Z")

</div>

😛 I’m trying to play Terran right now. A disaster. Once I get to the point where I make nothing but tanks I don’t know what to do. I think I was a Protoss in another life…

Cheers!

pom
