Unity3D flash compiler errors when compiling from C#

My project runs fine when I compile for iPhone, Android, Windows and OSX builds but for Flash I get the following errors and warnings:

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(115):
col: 24 Error: Call to a possibly
undefined method Round through a
reference with static type Class.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 27 Error: Type was not found or
was not a compile-time constant:
Random.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 40 Error: Call to a possibly
undefined method Random.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 40 Error: Call to a possibly
undefined method Random.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(5):
col: 15 Error: Definition
System:Random could not be found.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ContrastStretchEffect.as(98):
col: 120 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(18):
col: 32 Error: Type was not found or
was not a compile-time constant:
Stopwatch. public var
ScoreInst$timer$: Stopwatch = new
Stopwatch().Stopwatch_Constructor();

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(18):
col: 48 Error: Call to a possibly
undefined method Stopwatch.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(3):
col: 27 Error: Definition
System.Diagnostics:Stopwatch could not
be found.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Meteormaker.as(3):
col: 15 Error: Definition
System:Random could not be found.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\UpgradeBar.as(55):
col: 129 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\PlayerAvatar.as(58):
col: 30 Error: Call to a possibly
undefined method
PlayerAvatar_Constructor through a
reference with static type
global:PlayerAvatar.

Error building Player: Exception:
Compiling SWF Failed: Loading
configuration file C:\Program Files
(x86)\Unity\Editor\Data\PlaybackEngines\flashsupport\BuildTools\flex\frameworks\flex-config.xml

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(115):
col: 24 Error: Call to a possibly
undefined method Round through a
reference with static type Class.

  	$num =

Number(_Math.Round(Number($num), 0));
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 27 Error: Type was not found or
was not a compile-time constant:
Random.

  public static var rand: Random = new

Random().Random_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 40 Error: Call to a possibly
undefined method Random.

  public static var rand: Random = new

Random().Random_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(15):
col: 40 Error: Call to a possibly
undefined method Random.

  public static var rand: Random = new

Random().Random_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Interpolation.as(5):
col: 15 Error: Definition
System:Random could not be found.

import System.Random;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ContrastStretchEffect.as(98):
col: 120 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

  			(this.ContrastStretchEffect$adaptRenderTex$.elements[$i]

as
RenderTexture).Object_hideFlags_HideFlags
= HideFlags.HideAndDontSave;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(18):
col: 32 Error: Type was not found or
was not a compile-time constant:
Stopwatch.

  public var ScoreInst$timer$:

Stopwatch = new
Stopwatch().Stopwatch_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(18):
col: 48 Error: Call to a possibly
undefined method Stopwatch.

  public var ScoreInst$timer$:

Stopwatch = new
Stopwatch().Stopwatch_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(18):
col: 48 Error: Call to a possibly
undefined method Stopwatch.

  public var ScoreInst$timer$:

Stopwatch = new
Stopwatch().Stopwatch_Constructor();
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\ScoreInst.as(3):
col: 27 Error: Definition
System.Diagnostics:Stopwatch could not
be found.

import System.Diagnostics.Stopwatch;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Meteormaker.as(26):
col: 35 Error: Type was not found or
was not a compile-time constant:
Random.

  public var Meteormaker$m_rand$:

Random = new
Random().Random_Constructor_Int32(452);
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Meteormaker.as(26):
col: 48 Error: Call to a possibly
undefined method Random.

  public var Meteormaker$m_rand$:

Random = new
Random().Random_Constructor_Int32(452);
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Meteormaker.as(26):
col: 48 Error: Call to a possibly
undefined method Random.

  public var Meteormaker$m_rand$:

Random = new
Random().Random_Constructor_Int32(452);
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\Meteormaker.as(3):
col: 15 Error: Definition
System:Random could not be found.

import System.Random;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\UpgradeBar.as(55):
col: 129 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

  	($transform.Component_gameObject.GameObject_GetComponent$1$1(MeshRenderer.$Type)

as
MeshRenderer).Renderer_enabled_Boolean
= true;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\UpgradeBar.as(56):
col: 130 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

  	($transform2.Component_gameObject.GameObject_GetComponent$1$1(MeshRenderer.$Type)

as
MeshRenderer).Renderer_enabled_Boolean
= true;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\UpgradeBar.as(86):
col: 129 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

  	($transform.Component_gameObject.GameObject_GetComponent$1$1(MeshRenderer.$Type)

as
MeshRenderer).Renderer_enabled_Boolean
= false;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\UpgradeBar.as(87):
col: 130 Warning: Migration issue: *
is not a dynamic class. Instances
cannot have members added to them
dynamically.

  	($transform2.Component_gameObject.GameObject_GetComponent$1$1(MeshRenderer.$Type)

as
MeshRenderer).Renderer_enabled_Boolean
= false;
^

E:\meteormania\Temp\StagingArea\Data\ConvertedDotNetCode\global\PlayerAvatar.as(58):
col: 30 Error: Call to a possibly
undefined method
PlayerAvatar_Constructor through a
reference with static type
global:PlayerAvatar.

  	return new

PlayerAvatar().PlayerAvatar_Constructor();

		                          ^

Among a few other errors and warnings. Any ideas why and how to fix?

You have a lot going on there, so I don’t have a simple answer for you. I can tell you that every place I used “static” ended up being a problem when I tried to export to Flash. I’d suggest you refactor your static strategy and see where that gets you. It would also seem that the “Random” class is simply not supported (based on your errors, not on my specific knowledge). I generally use XOR-SHIFT or MT19937 or other algorithms, so I don’t know firsthand.

You have a lot going on there, so I don’t have a simple answer for you. I can tell you that every place I used “static” ended up being a problem when I tried to export to Flash. I’d suggest you refactor your static strategy and see where that gets you. It would also seem that the “Random” class is simply not supported (based on your errors, not on my specific knowledge). I generally use XOR-SHIFT or MT19937 or other algorithms, so I don’t know firsthand.