# Default variables in components

**URL:** https://forum.kirupa.com/t/default-variables-in-components/253658
**Category:** Uncategorized
**Created:** [March 3, 2008, 10:04pm UTC](https://forum.kirupa.com/t/default-variables-in-components/253658 "2008-03-03T22:04:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![activa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@activa](https://forum.kirupa.com/u/activa)
#### Post date: [March 3, 2008, 10:04pm UTC](https://forum.kirupa.com/t/default-variables-in-components/253658/1 "2008-03-03T22:04:08Z")

</div>

In an AS2 file I create a movieClip.Next, I define the movieClip as a component. In the component definition dialog, I define a component variable:

Name:My Variable, Variable:myVar, Default:32, Type:Number

In the script for the component I write “trace(‘this.myVar’)”. Compile and run, and the output is “32” as expected. Now I place another instance on the stage and set the value of My Variable to 27 in the Parameters dialog, compile & run, and the output is “32” and “27” as expected.

Now I convert to AS3. This time, the output is “undefined” and “27.” For some reason, AS3 doesn’t like the default variable setting. Any ideas what’s going on here?
