Flash Action Script Error Repository

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

Archive for March, 2010

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

ReferenceError: Error #1069: Property leadingModel not found on String and there is no default value.

ReferenceError: Error #1069: Property leadingModel not found on String and there is no default value.
at flashx.textLayout.elements::LinkElement/computeLinkFormat()[C:\Vellum\branches\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayout\elements\LinkElement.as:437]

Incorrect Code:

XML:
  1. <s:RichEditableText x="92" y="22" color="#2b4381" editable="false" fontFamily="Myriad Pro" fontSize="17" whiteSpaceCollapse="preserve">
  2.         <s:textFlow>
  3.             <s:TextFlow>
  4.                 <s:linkActiveFormat>
  5.                 </s:linkActiveFormat>
  6.                 <s:p>
  7.                     <s:a href="http://google.com"><s:span color="#f77d0e" textDecoration="none">link</s:span></s:a>
  8.                 </s:p>
  9.             </s:TextFlow>
  10.         </s:textFlow>
  11.     </s:RichEditableText>

Correct:

XML:
  1. <s:RichEditableText x="92" y="22" color="#2b4381" editable="false" fontFamily="Myriad Pro" fontSize="17" whiteSpaceCollapse="preserve">
  2.         <s:textFlow>
  3.             <s:TextFlow>
  4.                 <s:p>
  5.                     <s:a href="http://google.com"><s:span color="#f77d0e" textDecoration="none">link</s:span></s:a>
  6.                 </s:p>
  7.             </s:TextFlow>
  8.         </s:textFlow>
  9.     </s:RichEditableText>

No comments

TypeError: Bad element of type int passed to mxmlChildren at flashx.textLayout.elements::FlowGroupElement/set mxmlChildren

TypeError: Bad element of type int passed to mxmlChildren
at flashx.textLayout.elements::FlowGroupElement/set mxmlChildren()[C:\Vellum\branches\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayout\elements\FlowGroupElement.as:203]

I using data binding and I passed a integer inside a span tag as shown below. To fix it I had to cast it or convert it to a string.

XML:
  1. <s:RichEditableText x="20" y="100" color="#2b4381" editable="false" fontFamily="Myriad Pro" fontSize="17" width="494" height="55" whiteSpaceCollapse="preserve">
  2.         <s:textFlow>
  3.             <s:TextFlow>
  4.                 <s:p>
  5.                 <s:a href="http://google.com" color="#ffffff" textDecoration="none">   {data.contentCount} </s:a></s:p>
  6.             </s:TextFlow>
  7.         </s:textFlow>
  8.     </s:RichEditableText>

Correct:

XML:
  1. <s:RichEditableText x="20" y="100" color="#2b4381" editable="false" fontFamily="Myriad Pro" fontSize="17" width="494" height="55" whiteSpaceCollapse="preserve">
  2.         <s:textFlow>
  3.             <s:TextFlow>
  4.                 <s:p>
  5.                 <s:a href="http://google.com" color="#ffffff" textDecoration="none">   {String(data.contentCount)} </s:a></s:p>
  6.             </s:TextFlow>
  7.         </s:textFlow>
  8.     </s:RichEditableText>

No comments

TypeError: Bad element of type flashx.textLayout.elements::LinkElement passed to mxmlChildren

TypeError: Bad element of type flashx.textLayout.elements::LinkElement passed to mxmlChildren
at flashx.textLayout.elements::SpanElement/set mxmlChildren()[C:\Vellum\branches\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayout\elements\SpanElement.as:209]
at Test/_Test_SpanElement1_c()[/Users/monkeypunch/Documents/test/src/Test.mxml:5]

Incorrect:

XML:
  1. <s:RichText x="20" y="100" color="#2b4381" fontFamily="Myriad Pro" fontSize="17" tabStops="S0 S50 S100 S150 S200 S250 S300 S350 S400 S450 S500" width="494" height="55" whiteSpaceCollapse="preserve">
  2.         <s:content><s:p><s:span color="#f77d0e"><s:a href="http://google.com">{data.username}</s:a></s:span><s:span> </s:span><s:span color="#ffffff">posted 18 photos to</s:span><s:span> </s:span><s:span color="#0693ab">Web 2.0 Silicon Valley Design Team</s:span></s:p></s:content>
  3.     </s:RichText>

Correct: LinkElements cannot be children of span tags. Move the span inside of the link element or copy the attributes from the span to the link.

XML:
  1. <s:RichEditableText x="20" y="100" color="#2b4381" editable="false" fontFamily="Myriad Pro" fontSize="17" width="494" height="55" whiteSpaceCollapse="preserve">
  2.         <s:textFlow>
  3.             <s:TextFlow>
  4.                 <s:p><s:a href="http://google.com"><s:span color="#f77d0e" textDecoration="none">{data.username}</s:span></s:a><s:span color="#ffffff"> posted 18 photos to</s:span><s:span> </s:span><s:span color="#0693ab">Web 2.0 Silicon Valley Design Team</s:span></s:p>
  5.             </s:TextFlow>
  6.         </s:textFlow>
  7.     </s:RichEditableText>

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