Flex Builder 3 generates invalid ActionScript when creating an ActionScript Class with a default string-type argument
Issue
When you use Adobe Flex Builder to create an ActionScript Class (from the menus), if the constructor is to contain an argument of type String and also has a default value, the ActionScript generated by Flex Builder is incorrect.
Flex Builder creates the following constructor method:
Public function MyOtherStroke(color:uint=0, weight:Number=0, alpha:Number=1,
pixelHinting:Boolean=false, scaleMode:String=normal, caps:String=null,
joints:String=null, miterLimit:Number=0)
{
super(color, weight, alpha, pixelHinting, scaleMode, caps, joints, miterLimit);
}
Expected Results:
public function MyOtherStroke(color:uint=0, weight:Number=0, alpha:Number=1,
pixelHinting:Boolean=false, scaleMode:String='normal', caps:String=null,
joints:String=null, miterLimit:Number=0)
{
super(color, weight, alpha, pixelHinting, scaleMode, caps, joints, miterLimit);
}
The word normal in the scaleMode:String= argument should be in quotes.
Solution
To resolve this issue, you must manually edit the ActionScript code, adding the single (or double, if you wish) quotes around the default string value.
For example, scaleMode:String='normal'.
Additional Information
This article was published on July 29, 2008. If you are using a newer build of Flex than is mentioned here, this information may not apply to you.
A bug has been logged against Flex "Gumbo" for this issue and you may track progress here:
https://bugs.adobe.com/jira/browse/FB-13633
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
