# Control MC with AS

**URL:** <https://forum.kirupa.com/t/control-mc-with-as/6071>\
**Category:** Uncategorized\
**Created:** [September 28, 2002, 6:16pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071 "2002-09-28T18:16:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsavo](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tsavo](https://forum.kirupa.com/u/tsavo)\
**Post date:** [September 28, 2002, 6:16pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/1 "2002-09-28T18:16:04Z")

</div>

I´m trying to find out the mysterium about action scripting!!  
I’ve found a tut that tells u how to make objeckts move by using AS. Pretty easy! But what if I want to make it a little more advanced?

Lets say I have a line and I want it to scale to certain sice and I want the alpha to be 50, I can use this action:

onClipEvent(enterFrame) {  
this.\_alpha=50;  
if (this.\_xscale\<250){  
this.\_xscale+=50  
}  
}

But what if I want it to scale back or something, when it has executed the first code. How should I do that? I’ve tried to put in a similiar code after this one, but that doesn’t work. This is probably all very easy, and if someone could point me in the right direction would be great!

One more thing: when sould u use AS instead of tweens? what is the difference?

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 28, 2002, 6:22pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/2 "2002-09-28T18:22:07Z")

</div>

Use the code or php tag tsavo because I don’t know when the smily problem is going to be fixed. Also that code does nothing except set the alpha to 50 every time it enters a frame.

You could have done this in onClipEvent (load). And where you have

if (this.\_xscale\<25) {  
this.\_xscale += 50;

It won’t increase the xscale because it’s not less than 25 yet.

But it’s a good effort and the only way to learn. Did you come up with that yourself?

---

<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 28, 2002, 7:20pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/3 "2002-09-28T19:20:27Z")

</div>

I found some beginner stuff at [actionscrip.org](http://actionscrip.org)

the number 25 should have been 250! \*\*\*\* smileys!!  
My line increased until it reaced 250. That worked out okay, but if I want it to decrease afterwards, how should I do that? I tried to type in the code after the other one, but it seemed they worked against each other.

---

<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 28, 2002, 7:42pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/4 "2002-09-28T19:42:07Z")

</div>

```php
onClipEvent (load) {
	done = 0;
	this._alpha = 50;
}
onClipEvent (enterFrame) {
	if (this._xscale<250 && !done) {
		this._xscale += 50/2;
		if (this._xscale == 250) {
			done = 1;
		}
	}
	if (done) {
		this._xscale -= 50/2;
		if (this._xscale == 100) {
			done = 0;
		}
	}
}

```

Just makes it go bigger and smaller. Goes smaller when the variable done is true or 1. You can put this on a mouse event if you like.

---

<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 28, 2002, 8:06pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/5 "2002-09-28T20:06:12Z")

</div>

allright! thx! I’ll try and play aorund with it!!🙂

---

<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 28, 2002, 11:14pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/6 "2002-09-28T23:14:05Z")

</div>

Well Flex, read the article, because what I’m trying to explain there is that you don’t need that “done” variable anymore… 😛

---

<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 28, 2002, 11:31pm UTC](https://forum.kirupa.com/t/control-mc-with-as/6071/7 "2002-09-28T23:31:20Z")

</div>

What article?
