# Error #1065 on Variables that Exist

**URL:** <https://forum.kirupa.com/t/error-1065-on-variables-that-exist/313096>\
**Category:** flash\
**Created:** [August 19, 2010, 7:54pm UTC](https://forum.kirupa.com/t/error-1065-on-variables-that-exist/313096 "2010-08-19T19:54:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bnns](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bnns](https://forum.kirupa.com/u/bnns)\
**Post date:** [August 19, 2010, 7:54pm UTC](https://forum.kirupa.com/t/error-1065-on-variables-that-exist/313096/1 "2010-08-19T19:54:49Z")

</div>

I was working on a project in CS3 and since i’m getting closer to completion i started porting it to CS4 flashplayer 10. (bug is also present in CS5 when exporting for flash player 10.) Whenever i run the project this line is displayed: ReferenceError: Error #1065: Variable $elementInstruction is not defined. along with the stack.

To start off with the Class “IS” defined “PUBLIC” (though not in capitals). The area i am getting the problem is in the below code snippet:

Origional Code:

```auto
protected function digestString($instructions:String):void
        {
             var $instanceNameCommands:Array = $instructions.split("$");//String("owner-player_modifier-armor_modifi er-speed_units-78").split("_");
            for (var i:Number = $instanceNameCommands.length - 1; i >= 0; i-- )
            {
                var $elementInstruction:Array = $instanceNameCommands*.split("_");
                
                switch($elementInstruction[0])
                {

```

The Above code is the one i started with. The first variable to get the “Error #1065” was the $instructions variable, my fixes are in the below code, then the $instanceNameCommands var. the last var $elementInstruction was even a bigger problem b/c even after i made the modifications it still doesn’t work???

Modified:

```auto
public function digestString($instructions:String):void
     {
             var $instanceNameCommands:Array = ($instructions as String).split("$") as Array;//String("owner-player_modifier-armor_modifier-speed_units-78") .split("_");
            trace(($instanceNameCommands as Array).length)
            for (var i:Number = ($instanceNameCommands as Array).length - 1; i >= 0; i-- )
            {
                var $elementInstruction:Array = (($instanceNameCommands as Array)* as String).split("_") as Array;
                
                switch($elementInstruction[0] as String)
                {

```

I don’t know if this is related but the $instructions var is coming from var this.name where the class extends movieclip.

Any assistance that you provide would be greatly appreciated,  
bnns
