# \[AS\]One question: It is possible?

**URL:** <https://forum.kirupa.com/t/as-one-question-it-is-possible/184199>\
**Category:** flash\
**Created:** [April 3, 2006, 8:49am UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199 "2006-04-03T08:49:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)\
**Post date:** [April 3, 2006, 8:49am UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/1 "2006-04-03T08:49:48Z")

</div>

[FONT=Tahoma]Hi,

I have one question, it is possible to make a movieClip that containes some buttons, input/dynamic text area, but the action script to be taken from an external actionscript file (.as)?  
I ask this because i have some buttons that calles me movieClips who have actionscript applyed in them, i see that i have some error’s because of the actionscript (the .swf file blockes at one moment, and i don’t know why ☹ ) and i want to call the actionscript file (.as) to button when i press one button that displays me the movieClip attach to him.

Something like a class definition, but i don’t know if it’s working like this…

Thank you, Tiberiu.  
[/FONT]

---

<div class="post-metadata">

**Author:** ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)\
**Post date:** [April 3, 2006, 10:32am UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/2 "2006-04-03T10:32:15Z")

</div>

Write the entire code in some .as file that you are currently writing in a timeline and include that .as file in the same timeline.

---

<div class="post-metadata">

**Author:** ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)\
**Post date:** [April 3, 2006, 11:07am UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/3 "2006-04-03T11:07:10Z")

</div>

ok, thanks for the answer, and it’s working perfect.

I have some ???, if i do 1.as and 2.as (1.as for movieClip 1 and 2.as for movieClip 2) and in 1.as i have the var x with some property and in 2.as i have the same var with other property, do you think i will have problems?

---

<div class="post-metadata">

**Author:** ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)\
**Post date:** [April 3, 2006, 11:12am UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/4 "2006-04-03T11:12:24Z")

</div>

or some functions with the same name but inside only the component is different do you think it will crash the flash?

---

<div class="post-metadata">

**Author:** ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)\
**Post date:** [April 3, 2006, 12:25pm UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/5 "2006-04-03T12:25:24Z")

</div>

In any case such logical/syntactical errors won’t crash flash. They’ll just give compile time error.

Coming to your question of using same name for variable/function.  
It actually depends on the sequence of including the .as files.  
if you have include 1.as in frame 1 and 2.as in frame 3, all the variables of 1.as will be accessible in frame 1 till frame 2 and they’ll be rewritten in frame 3 if same name variable/function are used.

hope you got it. if not you can try an example on your own.

---

<div class="post-metadata">

**Author:** ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)\
**Post date:** [April 3, 2006, 12:29pm UTC](https://forum.kirupa.com/t/as-one-question-it-is-possible/184199/6 "2006-04-03T12:29:38Z")

</div>

ok, this has explained lot’s of stuff! i will include 1.as in the 1 movieclip and 2.as in the 2 movieclip, and in the mainmovie i will make to 2buttons that will call the 1mc and 2mc, i think everything will work ok. thank you again for you help!:A+:
