Flash Action Script Error Repository

A library of solutions to Actionscript, Flash, Flex and AIR

Archive for the 'Compiler' Category

Invalid component name ‘default’: component name must be legal ActionScript class name.

Invalid component name ‘default’: component name must be legal ActionScript class name. default.css

You cannot name a class or css file a reserved keyword such as, “if”, “else”, “switch”, “default”, etc

Incorrect filename:
default.css

Correct filename
styles.css

more info…

No comments

” declaration must be contained within the tag, since it is not assignable to the default property’s element type ‘mx.core.IVisualElement’.

” declaration must be contained within the <Declarations> tag, since it is not assignable to the default property’s element type ‘mx.core.IVisualElement’.

This is interesting! I pasted code in an ichat window then copied it out and pasted it back into the MXML application file. After that I started getting the error mentioned here. It turns out there are hidden invisible characters that are incompatible with the compiler.

So to fix this problem I had to erase the white space near where the error was. This fixed the problem. NOTE: It may be the error is on the line above or line below where it is being reported.

No comments

The dependency spark.components.Button from /Applications/Adobe Flash Builder 4/sdks/4.0.0/frameworks/libs/spark.swc has a minimum supported version of 4.0.0, which is higher than the compatibility version, 3.0.0.

The dependency spark.components.Button from /Applications/Adobe Flash Builder 4/sdks/4.0.0/frameworks/libs/spark.swc has a minimum supported version of 4.0.0, which is higher than the compatibility version, 3.0.0.

Problem
The “Use Flex 3 Compatibility mode” flag is checked in the Flash Builder compiler settings and conflicts with the Flex SDK version you have chosen. Read more here… http://opensource.adobe.com/wiki/display/flexsdk/Compatibility+Mode+SWC+Policy+(Mini+Specification)

Solution
Turn off this option in the Flex Compiler settings by unchecking this box in your project. Easy…

No comments

Initializer for ‘dataProvider’: values of type mx.collections.IList cannot be represented in text.

Initializer for 'dataProvider': values of type mx.collections.IList cannot be represented in text.

Problem

The problem is we are not enclosing the reference to array collection with curly braces. The list component thinks that we are passing a string. So changing from "myData" to "{myData}".

Incorrect code:

XML:
  1.     &lt;fx:Declarations&gt;
  2.  
  3. &lt;s:ArrayCollection id="myData"&gt;
  4. &lt;s:source&gt;
  5. &lt;fx:Object label="Engineering" data="ENG"/&gt;
  6. &lt;fx:Object label="Product Management" data="PM"/&gt;
  7. &lt;fx:Object label="Marketing" data="MKT"/&gt;
  8. &lt;/s:source&gt;
  9. &lt;/s:ArrayCollection&gt;
  10. &lt;/fx:Declarations&gt;
  11.  
  12. &lt;s:List dataProvider="myData" x="10" y="10" width="575" height="297" skinClass="ActivityStreamSkin"&gt;&lt;/s:List&gt;

Solution

XML:
  1. &lt;s:List dataProvider="{myData}" x="10" y="10"  width="575" height="297"  skinClass="ActivityStreamSkin"&gt;&lt;/s:List&gt;

No comments

The type selector ” was not processed, because the type was not used in the application.

The type selector 'Alert' was not processed, because the type was not used in the application.

Reason
The compiler is telling you that it can't find a case where the CSS that you are including inline or in a stylesheet is being used in the application. This is regardless if it will be used at another time. If it's not being used in the application it's not included at run time.

To remove this warning add the following line to the command line arguments:

-show-unused-type-selector-warnings=false

Note that "unused' type selectors aren't included to keep the file size down.

If you want to include every CSS type selector whether it's being used or not add the following line to the command line arguments:

-keep-all-type-selectors=true

To change command line arguments in Flash Builder navigate to Properties > Flex Compiler > Additional Compiler Arguments.

No comments

Error at line 29 in your MXML document

Error at line 29 in your MXML document

This means that the MXML document is not valid XML. It could be numerous things.

The easiest way to fix this is to "Undo" the last few changes you made. This should get you back to a valid XML document.

Unfortunately there is a bug when renaming links in Flash Builder that can cause this error when the document is actually valid. The fix is to close the MXML document and then reopen it.

No comments

The value of attribute “htmlText” must not contain the ‘<’ character.

The value of attribute "htmlText" must not contain the '<' character.

The problem code:

XML:
  1. <mx:Text id="postFooter1" width="100%" y="0"
  2. htmlText="Posted in <a href='event:{postsRepeater.currentItem.categories.category.@name}'>{postsRepeater.currentItem.categories.category.@name}</a>"  />

Because of the less than sigh, "<" the error was appearing. The solution is to encode the less than sign like so:

XML:
  1. <mx:Text id="postFooter1" width="100%" y="0"
  2. htmlText="Posted in &lt;a href='event:{postsRepeater.currentItem.categories.category.@name}'>{postsRepeater.currentItem.categories.category.@name}&lt;/a>"  />

No comments

The entity “raquo” was referenced, but not declared.

The entity "raquo" was referenced, but not declared.

The compiler does not like the entity, "raquo;" as shown in the htmlText attribute:

XML:
  1. <controls:TextAutoSize id="postFooter1" width="100%" y="55"
  2. htmlText="Comments &raquo;"  textAlign="center"/>

No solution is available at this time...

2 comments

Data binding expressions not supported with attributes processed at compile time.

Data binding expressions not supported with attributes processed at compile time.

This error occurred when I tried to bind the source property of a Style.

XML:
  1. <mx:Style source="{style}" />

No comments

The prefix “mx” for element “mx:VBox” is not bound.

The prefix "mx" for element "mx:VBox" is not bound.

Explanation:
The prefix "mx" is not bound to any namespace definition. In my case the namespace definition was missing in my MXML component.

Incorrect

XML:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:VBox>
  3.    
  4. </mx:VBox>

Correct

XML:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
  3.    
  4. </mx:VBox>

No comments

Event type ‘com.flexcapacitor.events:StateHandler’ is unavailable.

Event type 'com.flexcapacitor.events:StateHandler' is unavailable.

Here is the line causing the error:

XML:
  1. <managers:StateHandler state="{productsState1}" callFunction="Alert.show(ObjectUtil.toString(event))"/>

If I remove the callFunction attribute the error goes away. So what's the issue?

In my StateHandler class I have this metadata:
[Event(name="callFunction", type="com.flexcapacitor.events.StateHandler")]

The problem is the class is defined as StateHandlerEvent not StateHandler. So I change it StateHandlerEvent and it works:
[Event(name="callFunction", type="com.flexcapacitor.events.StateHandlerEvent")]

From the documentation

If you do not identify an event with the [Event] metadata tag, the compiler generates an error if you try to use the event name in MXML. The metadata for events is inherited from the superclass, however, so you do not need to tag events that are already defined with the [Event] metadata tag in the superclass.

No comments

1046: Type was not found or was not a compile-time constant: ContentElement. TextLayoutFramework

Error Message

1046: Type was not found or was not a compile-time constant: ContentElement. TextLayoutFramework
[etc] ElementFormat. FontMetrics. TextElement. TextLine. Vector.

Cause
In this case the class was not found because I was specifying Flash Player 9 when the class was in Flash Player 10.

Solution
When I went into the Project Properties > Flex Compiler and changed the required version to 10.0.0 the errors went away.

Please note this is a case post. There are additional posts on this error.

2 comments

Next Page »