# Trying to name a variable

**URL:** https://forum.kirupa.com/t/trying-to-name-a-variable/299423
**Category:** Uncategorized
**Created:** [November 4, 2009, 9:39pm UTC](https://forum.kirupa.com/t/trying-to-name-a-variable/299423 "2009-11-04T21:39:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![decimal](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@decimal](https://forum.kirupa.com/u/decimal)
#### Post date: [November 4, 2009, 9:39pm UTC](https://forum.kirupa.com/t/trying-to-name-a-variable/299423/1 "2009-11-04T21:39:05Z")

</div>

I have a 2 frame movie. It’s basically drag and drop movieclips onto targets and see if they’re correct. When the draggable movie clip is dropped onto the correct movie clip, the user clicks a done button and sees if they got it right or wrong. An if loop is checking which are correct. What I want to do is to assign the correct targets on the first frame and then these will be used to name the variables on the done button.

First frame:

```php

var ans1:Number = 1; 

```

Here’s the code for the button:

```php
on (release) { 
//if the draggable object 1 is dropped on the correct target (1)     
if (this.Drag1._y == this.Target+_root.ans1._y) 
{  
//CORRECT, display a correct sign         
this.tick0+_root.ans1.gotoAndStop(1);     
} else {  
//WRONG, display incorrect sign         
this.tick0+_root.ans1.gotoAndStop(2);     
}
 } 

```

I know this is completely wrong, I don’t know how I should do it. Can anyone help a beginner out?
