# Button script please

**URL:** <https://forum.kirupa.com/t/button-script-please/30158>\
**Category:** Uncategorized\
**Created:** [September 4, 2003, 3:01pm UTC](https://forum.kirupa.com/t/button-script-please/30158 "2003-09-04T15:01:22Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![robbie\_star](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@robbie\_star](https://forum.kirupa.com/u/robbie_star)\
**Post date:** [September 4, 2003, 3:01pm UTC](https://forum.kirupa.com/t/button-script-please/30158/1 "2003-09-04T15:01:22Z")

</div>

hi guys

can some please help me out with a action script.  
it so that when hit a button it will display the file that sits in the the libary. but if they hit anthor button then that file go away and the other file will apper.

thanks guys

---

<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:** [September 4, 2003, 4:18pm UTC](https://forum.kirupa.com/t/button-script-please/30158/2 "2003-09-04T16:18:26Z")

</div>

me wrong

---

<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:** [September 4, 2003, 4:39pm UTC](https://forum.kirupa.com/t/button-script-please/30158/3 "2003-09-04T16:39:55Z")

</div>

On the main timeline …

[AS]  
button1.onRelease = function(){  
holder.removeMovieClip();  
holder.attachMovie(“linkageID1”,“movie1”,1);  
}  
button2.onRelease = function(){  
holder.removeMovieClip();  
holder.attachMovie(“linkageID2”,“movie2”,1);  
}  
[/AS]

---

<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:** [September 4, 2003, 4:40pm UTC](https://forum.kirupa.com/t/button-script-please/30158/4 "2003-09-04T16:40:10Z")

</div>

thanks for the reply but i will need a bit more help as i dont know how to place action script or what the script is tell what to do.

should i put this srcipt on each button and then how will it know what file in the libary to open in the movie.

then also if u open button 2 will the file for button 1 go away or will it load on top

thanks

---

<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:** [September 4, 2003, 4:48pm UTC](https://forum.kirupa.com/t/button-script-please/30158/5 "2003-09-04T16:48:41Z")

</div>

Wouldn’t it be easier just to make your buttons, then put an empty movieClip on the stage and put this action _on_ the button?

```auto

on(release){
_root.movieClipName.loadMovie("file.swf");
}
//then on the other button
on(release){
_root.movieClipName.loadMovie("otherfile.swf");
}

```

movies will automatically unload themselves when another is loaded in…  
😛

---

<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:** [September 4, 2003, 4:50pm UTC](https://forum.kirupa.com/t/button-script-please/30158/6 "2003-09-04T16:50:06Z")

</div>

Yes Freddy, that would indeed be easier, but he asked from the library … Though robbie, Freddy is right, it would be better to load them externally, especially for your filesize.

Here’s another way to do it. On the main timeline …  
[AS]  
this.createEmptyMovieClip(“holder”,1);  
//creates an empty movieclip on the main timeline  
holder.loadMovie(“file1.swf”);  
//loads the initial file  
mc = 1;  
//sets a var to check the current mc  
button1.onRelease = function(){  
if(mc==2) {  
holder.loadMovie(“file1.swf”)  
mc=1;  
}  
}  
button2.onRelease = function(){  
if(mc==1){  
holder.loadMovie(“file2.swf”)  
mc=2;  
}  
}  
[/AS]

---

<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:** [September 4, 2003, 5:07pm UTC](https://forum.kirupa.com/t/button-script-please/30158/7 "2003-09-04T17:07:54Z")

</div>

> \*Originally posted by robbie star \*  
> \*\*thanks for the reply but i will need a bit more help as i dont know how to place action script or what the script is tell what to do.

should i put this srcipt on each button and then how will it know what file in the libary to open in the movie.

then also if u open button 2 will the file for button 1 go away or will it load on top

thanks \*\*

I think it’s time to hit the basic AS tutorials.

---

<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:** [September 4, 2003, 5:43pm UTC](https://forum.kirupa.com/t/button-script-please/30158/8 "2003-09-04T17:43:33Z")

</div>

hi guys

i have tryed but cant get it to work. ok i know im dum but i am trying. i thought i would post the fla file see if u guys could help me a bit more. what i need is when click on the button that says (QUEM SOMOS) it will load (TEXT 1) that is in the libary. but also i need it to go away when they press any of the other buttons.

Please Please help i have been all day pulling my hair out with this. im nearly bold

Thanks

---

<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:** [September 4, 2003, 6:05pm UTC](https://forum.kirupa.com/t/button-script-please/30158/9 "2003-09-04T18:05:20Z")

</div>

FLA ? Where ? 😉

---

<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:** [September 4, 2003, 6:16pm UTC](https://forum.kirupa.com/t/button-script-please/30158/10 "2003-09-04T18:16:40Z")

</div>

how do you add a fla file on the message thread

---

<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:** [September 4, 2003, 6:18pm UTC](https://forum.kirupa.com/t/button-script-please/30158/11 "2003-09-04T18:18:50Z")

</div>

Ahhh…I didn’t see the library thing, my bad…  
Robbie, hit post reply and then at the bottom of the post form there’s a ‘browse’ button - hit it, click on the fla. (-:

---

<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:** [September 4, 2003, 6:26pm UTC](https://forum.kirupa.com/t/button-script-please/30158/12 "2003-09-04T18:26:06Z")

</div>

he sorry im in such a mess that i didnt even see that

thanks

---

<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:** [September 4, 2003, 6:34pm UTC](https://forum.kirupa.com/t/button-script-please/30158/13 "2003-09-04T18:34:27Z")

</div>

heres the fla

---

<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:** [September 4, 2003, 6:55pm UTC](https://forum.kirupa.com/t/button-script-please/30158/14 "2003-09-04T18:55:08Z")

</div>

It’s still not there :-\

---

<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:** [September 4, 2003, 7:04pm UTC](https://forum.kirupa.com/t/button-script-please/30158/15 "2003-09-04T19:04:42Z")

</div>

it will not send as its too big

---

<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:** [September 4, 2003, 7:35pm UTC](https://forum.kirupa.com/t/button-script-please/30158/16 "2003-09-04T19:35:25Z")

</div>

I got your PM and I don’t mind, however, you never said which way you want to do. Did you want to load from the library, or externally? Because if you want to load the pics externally, you won’t have to send anybody anything. There’s a tut here on how to do it and about a thousand threads to show you how - it’s fairly simple.

Voetsjoeba? What’s going on with your footer? Server down? My SQL’s down too. Ⓜ

---

<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:** [September 4, 2003, 7:38pm UTC](https://forum.kirupa.com/t/button-script-please/30158/17 "2003-09-04T19:38:49Z")

</div>

_Realises_ Yes ! I knew it was down but I didn’t think of my footer since I browse these forums with signatures off. Thanks for reminding me =)

_Removes footer_
