# Actionscript 2.0 Classes dollar sign

**URL:** <https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923>\
**Category:** flash\
**Created:** [November 7, 2003, 10:16pm UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923 "2003-11-07T22:16:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![boristheblade](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@boristheblade](https://forum.kirupa.com/u/boristheblade)\
**Post date:** [November 7, 2003, 10:16pm UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/1 "2003-11-07T22:16:39Z")

</div>

What is the deal with the dollar sign in this tutorial found at mm?

[3D classes tutorial](http://www.macromedia.com/devnet/mx/flash/articles/3d_classes.html)

What is the purpose of the dollar sign?  
Here is a sample of the code:

[AS]class com.lo9ic.Style {  
private var $linealpha, $lineweight, $fillalpha : Number;  
private var $linecolor, $fillcolor : String;

function Style() {  
$lineweight = 0;  
$linealpha = 100; $fillalpha = 100;  
$linecolor = “0x000000”; $fillcolor = “0x000000”;  
}

public function set linealpha(a:Number):Void {  
$linealpha = a;  
}[/AS]

---

<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 7, 2003, 11:56pm UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/2 "2003-11-07T23:56:05Z")

</div>

None, really. It’s simply a valid character that you can use to name your objects/functions/properties/etc; like a, b, c, and 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:** [November 8, 2003, 3:03am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/3 "2003-11-08T03:03:23Z")

</div>

Thats what I figured, but I tried replicating these classes with out using the $ and am getting some compile errors…

I guess I am overlooking something.

---

<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 8, 2003, 3:23am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/4 "2003-11-08T03:23:07Z")

</div>

… What’s the error you get? :-\

---

<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 8, 2003, 4:50am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/5 "2003-11-08T04:50:14Z")

</div>

Ugh…  
I dont have MX 2004 at home so I wont be able to tell you till monday afternoon.

Thanks for the help though!

---

<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 8, 2003, 4:55am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/6 "2003-11-08T04:55:53Z")

</div>

Ok! And now I get to wait. 😛

---

<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 8, 2003, 5:08am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/7 "2003-11-08T05:08:57Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?postid=121266&highlight=\*%24onDoubleClick\*#post121266](http://www.kirupaforum.com/forums/showthread.php?postid=121266&highlight=%2A%24onDoubleClick%2A#post121266) 😛

---

<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 8, 2003, 6:58am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/8 "2003-11-08T06:58:40Z")

</div>

Ok. So let me make sure I understand this.

The $ is used for private variables.

So do all private vars have to start with $?

The reason I ask is because when I take the $ away from all the private vars, the compiler doesnt like it.

Note: I am only implementing the implicit get/set functions in my classes right now.

Thanks for the help.

---

<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 8, 2003, 7:02am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/9 "2003-11-08T07:02:26Z")

</div>

the $ is optional, and in fact, leading a variable name by a dollar sign doesn’t make it private. It’s just to indicate that this variables was declared Private 🙂

What erros does the compiler throw?

---

<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 8, 2003, 7:03am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/10 "2003-11-08T07:03:39Z")

</div>

public function set linealpha(a:Number):Void

that line is causing the error cause when your delete the $ signs linealpha has it’s type messed with and flash gives an error.

If you change the $linealpha to something like linealpha1 it should work fine

Anyway good luck,  
Shawn

---

<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 8, 2003, 7:20am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/11 "2003-11-08T07:20:07Z")

</div>

Haha! How on earth could I miss that!? 😛

---

<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 8, 2003, 8:04am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/12 "2003-11-08T08:04:23Z")

</div>

The forest through the trees…I hate those little things that cause big problems,  
Shawn

---

<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 8, 2003, 8:08am UTC](https://forum.kirupa.com/t/actionscript-2-0-classes-dollar-sign/34923/13 "2003-11-08T08:08:04Z")

</div>

Yeah, me too. It’s really annoying sometimes. :hair:
