# Problems with attatching movie clips

**URL:** <https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301>\
**Category:** Uncategorized\
**Created:** [August 25, 2003, 3:04pm UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301 "2003-08-25T15:04:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveeed](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@daveeed](https://forum.kirupa.com/u/daveeed)\
**Post date:** [August 25, 2003, 3:04pm UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301/1 "2003-08-25T15:04:03Z")

</div>

I have created this little bit of coding for an idea I had,the only problem is is that it wont work.

//create object  
keyListener = new Object();  
//use onKeyDown function  
keyListener.onKeyDown = function() {  
//get the Ascii code  
keypressed = Key.getAscii();

```
//if the letter press is 99 ("c")
if (keypressed == 99 or keypressed == 67)
this.attachMovie("movieclip");

```

};  
//add listener to keys for this to work  
Key.addListener(keyListener);

I want it so when a key on the keyboard(c in this example)is pressed it loads up a movie clip in place of the one on the page and plays it.I have tried many different things but still can not get it to work.

Does anyone have any ideas?

Cheers

---

<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:** [August 26, 2003, 2:50am UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301/2 "2003-08-26T02:50:50Z")

</div>

Hmmm…I thought someone on here would have a better idea on this.

---

<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:** [August 26, 2003, 5:46am UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301/3 "2003-08-26T05:46:40Z")

</div>

I’d wait a little longer than 14 minutes for a response. I don’t know how to do what you’re doing, but I know others here do. 🙂

---

<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:** [August 26, 2003, 9:45am UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301/4 "2003-08-26T09:45:55Z")

</div>

well here’s a partial start::  
//on frame one, main timeline

```auto
Key.addListener(this);

this.onKeyDown = function() {
	if (Key.isDown(67)) {    
		loadMovieNum("something.swf", 1);
	}  
}

```

this will load an external swf by pressing “c”

with a little tweaking you could modify this to get different swf’s and from different key presses

---

<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:** [August 26, 2003, 8:29pm UTC](https://forum.kirupa.com/t/problems-with-attatching-movie-clips/29301/5 "2003-08-26T20:29:05Z")

</div>

Thanks a lot for the reply and you have helped me quite a bit =]

What if i wanted to attach a movieclip(that isnt in the main scene) from the library? How would I be able to do that?
