# Executing an action once

**URL:** <https://forum.kirupa.com/t/executing-an-action-once/7950>\
**Category:** Uncategorized\
**Created:** [November 11, 2002, 4:03am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950 "2002-11-11T04:03:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyeinfinitude](https://avatars.discourse-cdn.com/v4/letter/e/ed8c4c/32.png) [@eyeinfinitude](https://forum.kirupa.com/u/eyeinfinitude)\
**Post date:** [November 11, 2002, 4:03am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950/1 "2002-11-11T04:03:03Z")

</div>

I’m using the loadmovie action on a frame that is played several times when certain buttons are clicked and the problem is that everytime the frame is played it would load the new movie again. Is there a way to disable the loadmovie action after it is executed the first time? I only need it to play once and thats it. Any help would be appreciated, thanks in advance. Oh and I’m using flash MX by the way. =)

---

<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:** [November 11, 2002, 5:52am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950/2 "2002-11-11T05:52:49Z")

</div>

yep.

if(loadTrip!=true){  
loadMovie();  
loadTrip=true;  
}

a good programer would include

loadTrip=false;

in one of the first frames of the movie… just to initialize the variable, but I don’t think it’s necessary. The first time the command is reached, the loadTrip will not equal anything, hence fullfilling the if statement. As soon as the loadMovie command is executed, the script sets the var to true, and the if statement will never be fullfilled again.

---

<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:** [November 11, 2002, 6:45am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950/3 "2002-11-11T06:45:20Z")

</div>

wow that was fast, thanks David, works like a charm! =)

---

<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:** [November 11, 2002, 7:03am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950/4 "2002-11-11T07:03:01Z")

</div>

np, I live to serve. 😛 Welcome to Kirupa… I hope all your questions are that easy to solve. 😉

---

<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:** [November 11, 2002, 8:29am UTC](https://forum.kirupa.com/t/executing-an-action-once/7950/5 "2002-11-11T08:29:30Z")

</div>

Here you go David, this is my site. You just helped me complete my first decent flash site. I’ve only been working with flash for about 3 months so theres still bugs I need to work out, but take a look at it when you have time and maybe give me some pointers, thanks again. =)

[http://www15.brinkster.com/ozzo481/main.html](http://www15.brinkster.com/ozzo481/main.html)
