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