# \[MX\] Modify scale and alpha of image via input txt boxes

**URL:** https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463
**Category:** flash
**Created:** [July 23, 2003, 10:53am UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463 "2003-07-23T10:53:45Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Demonia](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@Demonia](https://forum.kirupa.com/u/Demonia)
#### Post date: [July 23, 2003, 10:53am UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/1 "2003-07-23T10:53:45Z")

</div>

I really need some help please. I have just started learning AS from this book and am having a little trouble. I have to make a thingie whereby when u enter values into 2 input txt boxes an image modifies its scale and alpha accordingly. Now I have done everything I am supposed to but the funny thing is NOTHING happens. I’ll post the code (I applied it to the button which I think is right)…

on (release, keyPress “\<Enter\>”) {  
if (\_root.scale\>100) {  
gotoAndPlay(1);  
} else {  
myClip.\_alpha = “opacity”;  
myClip.\_yscale = “scale”;  
myClip.\_xscale = “scale”;  
}  
}

The script on frame 1 is

scale = " ";  
opacity = " ";  
\_root.myClip.\_alpha = 100;  
\_root.myClip.\_yscale = 100;  
\_root.myClip.\_xscale = 100;

and on frame 2

stop ();

I need to figure this out cause I don’t see the point of going on if i don’t understand what’s wrong with this…

Thanks a billion,

D :beam:

---

<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: [July 23, 2003, 11:26am UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/2 "2003-07-23T11:26:30Z")

</div>

First off, you’re setting the scales to a string, “scale”, not the variable, so kill the quotes. Now with text boxes, the value in any textbox will always be a string, so you have to do a little type conversion. In this case, you want Number(_value_);

so change this:

```auto
myClip._alpha = "opacity";
myClip._yscale = "scale";
myClip._xscale = "scale";

```

to this:

```auto
myClip._alpha = Number(opacity);
myClip._xscale = myClip._yscale = Number(scale);

```

Lastly with the textboxes, make sure that their variables are set, not just the instance name, to “scale” or “opacity” (w/o quotes).

---

<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: [July 23, 2003, 11:32am UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/3 "2003-07-23T11:32:17Z")

</div>

Thanks for your time but unfortunately it still doesn’t work…

D :beam:

---

<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: [July 23, 2003, 12:12pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/4 "2003-07-23T12:12:15Z")

</div>

May I see your FLA, sir.

:hat:

---

<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: [July 23, 2003, 12:24pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/5 "2003-07-23T12:24:11Z")

</div>

Please do not look at the design … I just plonked some stuff in there to try and do this (in other words it looks like it’s been put together by a rhino) :sigh:

I don’t know how to get it to you cause it;s 220 kb ☹ and zipped it’s 180 kb … please help  
Thanx,

D

---

<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: [July 23, 2003, 12:51pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/6 "2003-07-23T12:51:52Z")

</div>

Here, let me give you an FLA instead showing you how it’s done.

---

<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: [July 23, 2003, 1:42pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/7 "2003-07-23T13:42:03Z")

</div>

All I can say is thanks a lot for taking the time to help me, you are an angel :beam:

D 🙂

---

<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: [July 23, 2003, 2:15pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/8 "2003-07-23T14:15:37Z")

</div>

Here you go, sorry for the delay, i’m at work so i have to balance everything out.

Anyway, I put this together real quick, but it works.

Pay close attention to all the details in this movie, including variable names, instance names, actions, etc.

---

<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: [July 23, 2003, 2:20pm UTC](https://forum.kirupa.com/t/mx-modify-scale-and-alpha-of-image-via-input-txt-boxes/26463/9 "2003-07-23T14:20:46Z")

</div>

Thank you very much - I understand now how it works :beam: …

D 🙂
