# Make the code shorter?

**URL:** <https://forum.kirupa.com/t/make-the-code-shorter/111564>\
**Category:** Uncategorized\
**Created:** [May 28, 2004, 6:05am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564 "2004-05-28T06:05:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![helga](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@helga](https://forum.kirupa.com/u/helga)\
**Post date:** [May 28, 2004, 6:05am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564/1 "2004-05-28T06:05:09Z")

</div>

Hello everyone^^  
It’s my first post here, and my english is not very good, so I’m a bit stressed ^^. I hope I post in the good section.

Well. It’s not really about a problem that I ask, it’s just that I ask me some questions about how to mak some actionscripts shorter and more smart maybe.

I wonder if tere is a way to write shorter:

```auto
Mc.onRollOver = function() {
blahblahblah...}
Mc.onRollOut = function() {
nanananananana....}
titleMc.onPress = function() {
lalalalalalalala....}

```

btw: I discovered a few time ago,

```auto
that if(....){
blahblahblah...}

```

could be written a shorter way, but I can’t find the syntax no more 😉

Hope you can help me growing as a lil coder… ^^

_~H~_

---

<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:** [May 28, 2004, 6:58am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564/2 "2004-05-28T06:58:48Z")

</div>

er…  
If you don’t know, you can say just “Hi” ^^ …

Helga

---

<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:** [May 28, 2004, 7:01am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564/3 "2004-05-28T07:01:28Z")

</div>

bonjour and welcome,  
if blahblahblah, nannanannanana and lalalallalalal are all the same script then yes there is a way make it shorter

```auto
function everything() {
blah
nana
lala
...
}

Mc.onRollOver = everything;
Mc.onRollOut = everything;
titleMc.onPress = everything;

```

if not, then what you are doing cant be made any shorter  
i hope this helps

---

<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:** [May 28, 2004, 7:03am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564/4 "2004-05-28T07:03:23Z")

</div>

and btw about that if question you had, have a look at this:  
[http://www.kirupa.com/developer/actionscript/tricks/tertiary.htm](http://www.kirupa.com/developer/actionscript/tricks/tertiary.htm)

---

<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:** [May 28, 2004, 7:16am UTC](https://forum.kirupa.com/t/make-the-code-shorter/111564/5 "2004-05-28T07:16:58Z")

</div>

Hi^^  
Thank you both for the effort on speaking my language and for your helpfull answer.  
Unfortunatly, blah, nana, & lala (lol…so stupid…lol) aren’t the same script. I guess what I’m looking for doesn’t exist.  
The link you gave me is just great ! thank you ! I’ve been looking for it for a long time. So, it’s called “tertiary operator”. Won’t forget it this time 😉  
Thank you so much (^.^).

Have a Nice day, David  
Helga
