Actionscript 2.0 Classes dollar sign

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

3D classes tutorial

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]

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. :stuck_out_tongue:

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.

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

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

Thanks for the help though!

Ok! And now I get to wait. :stuck_out_tongue:

http://www.kirupaforum.com/forums/showthread.php?postid=121266&highlight=*%24onDoubleClick*#post121266 :stuck_out_tongue:

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.

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 :slight_smile:

What erros does the compiler throw?

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

Haha! How on earth could I miss that!? :stuck_out_tongue:

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

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