# Variable quesiton

**URL:** <https://forum.kirupa.com/t/variable-quesiton/8298>\
**Category:** Uncategorized\
**Created:** [November 18, 2002, 2:18am UTC](https://forum.kirupa.com/t/variable-quesiton/8298 "2002-11-18T02:18:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jeremy](https://forum.kirupa.com/u/jeremy)\
**Post date:** [November 18, 2002, 2:18am UTC](https://forum.kirupa.com/t/variable-quesiton/8298/1 "2002-11-18T02:18:50Z")

</div>

Is it possible to give a variable to the \_xscale of a given MC.?  
i wonder because I ran into a problem with this example:

this is just a simple experiment file I was messing with, here’s the problem.  
I have a MC, that i want to be able to modify the xscale by an input box and button. basically the user inputs a value, presses the button, and the \_xscale of the MC chages to what they put in the input box.  
so my MC is named graph.  
the input box has a var of xsize.  
the button works fine if I use  
on release  
graph.\_xscale = xsize

but when I try to give graph.\_xscale a variable like MCsize

on release  
MCsize = xsize

that doesn’t work.

is it my syntax or just that I can’t give a property of a MC a variable name?

---

<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:** [November 18, 2002, 8:27am UTC](https://forum.kirupa.com/t/variable-quesiton/8298/2 "2002-11-18T08:27:34Z")

</div>

you seem a bit confused about what a variable is. It is just a container for whatever you want… You can assign virtually anything to a variable.  
I wish I could help but your questrion is a little vague…  
What “doesn’t work”?

All that MCsize = xsize; does is to assign the value of xsize to MCsize and you can check that this is working with: trace(youVariable); in your script.

Try to think you’re assigning values to variables instead of “giving a variable to” properties and other components. It should help you a little.

---

<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:** [November 18, 2002, 9:16am UTC](https://forum.kirupa.com/t/variable-quesiton/8298/3 "2002-11-18T09:16:13Z")

</div>

I think my confusion lies in that I thought i could assign  
a variable of MCsize = graph.\_xscale.  
and then modify it by another action.  
like a button…example:  
on release  
MCsize = 55.  
which would change the xscale to 55

when I do that, and I debug it…it shows that there is the  
correct value of MCsize, but the xscale of graph movie clip has not been changed to 55.

I am confused because my graph movie clip is not scaling when I set a new value to MCsize. so if ya can’t do that and that won’t work, fine, I thought I could…but if you can do that…how?

---

<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:** [November 18, 2002, 9:34am UTC](https://forum.kirupa.com/t/variable-quesiton/8298/4 "2002-11-18T09:34:59Z")

</div>

whenever you write:  
variable = value;  
you assign the value to the variable.  
when you write:  
MCsize = graph.\_xscale;  
you’re assigning the value graph.\_xscale to MCsize.  
you want to do graph.\_xscale = MCsize;

But they’re many other things that could go wrong with variables (scope, life span, etc…) and I would recommended reading “ActionScript, the definite guide” (o’reilley) to get the basic ideas of variales, functions, etc… If not you’ll waste time/get frustrated.  
Hope that 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:** [November 18, 2002, 10:38am UTC](https://forum.kirupa.com/t/variable-quesiton/8298/5 "2002-11-18T10:38:42Z")

</div>

thanks again, that was the problem…I have a friend that can let me borrow that book, I guess I will have to check it out.

thanks again.
