Flash Action Script Error Repository

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

Archive for the 'Runtime' Category

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 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: Unexpected element spanwithin a span

Error: Unexpected element spanwithin a span (sic)

Reason
Span's cannot contain other spans. Spans can only contain text. More information...

Spans should be closed off before starting a new one.

Original Code:

XML:
  1. public var myString:XML = <div><img source="images/spinning_loader1.swf"/><span fontStyle="italic"><span fontWeight="bold">Flex is a highly productive, free open source framework for building and maintaining expressive web applications...</span></span><br/></div>;

Correct code:

XML:
  1. <flow:span>Some text that is </flow:span><flow:span fontWeight="bold">bold and </flow:span><flow:span fontWeight="bold" textDecoration="underline">bold and underlined</flow:span>

No comments

ArgumentError: newElement not of a type that this can be parent of

ArgumentError: NewElement not of a type that this can be parent of

Reason
TextFlow markup is malformed. It does not allow certain elements to contain other elements. For example, a paragraph cannot contain another paragraph. It also occurs when you have line breaks in your markup tags, "\n\t\t\t\t".

Incorrect:

XML:
  1. <s:RichEditableText x="93" y="22">
  2.         <s:content>
  3.             <s:TextFlow xmlns="http://ns.adobe.com/textLayout/2008">

Notice the line break after the content tag.

Correct:

XML:
  1. <s:RichEditableText x="93" y="22">
  2.         <s:content><s:TextFlow xmlns="http://ns.adobe.com/textLayout/2008">

Read more here...

No comments

Error: Unknown element http://ns.adobe.com/textLayout/2008::

Error: Unknown element http://ns.adobe.com/textLayout/2008::

Reason
The element in the markup is not found. For example, the "em" tag is not supported. So when it is encountered an error with the message "Unknown element http://ns.adobe.com/textLayout/2008::em" is thrown. Notice the "em" is tagged at the end of the error message. It may be possible to create an em element. Not sure. Read more here...

Incorrect Code:

Actionscript:
  1. public var myString:XML = <root><img source="images/spinning_loader1.swf"/><span>Flex is a highly productive, free open source framework for building and maintaining expressive web applications...</span><br/></root>;

XML:
  1. <s:RichEditableText width="100%" y="52" styleName="postDescription" text="Description area"
  2.     editable="false" lineBreak="toFit" textFlow="{TextFlowUtil.importFromString(XML(myString))}">
  3. </s:RichEditableText>

Correct Code:

Actionscript:
  1. public var myString:XML = <p><img source="images/spinning_loader1.swf"/><span>Flex is a highly productive, free open source framework for building and maintaining expressive web applications...</span><br/></p>;

No comments

ArgumentError: newElement not of a type that this can be parent of

ArgumentError: newElement not of a type that this can be parent of

Reason

Incorrect Code:

XML:
  1. <s:RichEditableText x="11" y="35" text="Just text
" width="352">
  2.         <s:TextFlow color="0x555555">
  3.             <s:p>
  4.                 <s:span fontWeight="bold">Just text</s:span>
  5.                 <s:br />
  6.                 <s:a href="http://twitter.com/">Click here</s:a>
  7.                 <s:p>
  8.                     <s:img source="images/node_loader1.swf"></s:img>
  9.                 </s:p>
  10.             </s:p>
  11.         </s:TextFlow>
  12.  
  13.     </s:RichEditableText>

No comments

Unable to generate initialization code within Repeater, due to id or data binding on a component that is not a visual child.

Unable to generate initialization code within Repeater, due to id or data binding on a component that is not a visual child.

Reason
Unknown

Incorrect Code:

XML:
  1. <s:RichEditableText width="100%" y="52" styleName="postDescription" text="Description area" editable="false">
  2.     <s:TextFlow xmlns="http://ns.adobe.com/textLayout/2008">{TLFFormatter.format(XML(postsRepeater.currentItem).content)}</s:TextFlow>
  3. </s:RichEditableText>

No comments

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

TypeError: Bad element of type flashx.textLayout.elements::TextFlow passed to FlowGroupElement.mxmlChildren
Reason
I think because I passed in an XMLList (converted by the Flex framework) instead of a format it was looking for. It can accept arrays, strings, etc.

Incorrect Code:

XML:
  1. <s:RichEditableText width="100%" y="52" styleName="postDescription" text="Description editable="false" content="{XML(postsRepeater.currentItem).content}"/>

Correct Code:

XML:
  1. <s:RichEditableText width="100%" y="52" styleName="postDescription" text="Description editable="false" content="{String(XML(postsRepeater.currentItem).content)}"/>

No comments

Error: No class registered for interface ‘mx.styles::IStyleManager2′.

Error: No class registered for interface 'mx.styles::IStyleManager2'.

The problem occurred when I would launch my MXML file from Flex Builder. The problem was that I was launching an MXML file that was based on "Canvas" on accident. It wasn't launching the Application.

Solution
Check that the file you are launching is of type "Application".

No comments

Error: Find criteria must contain at least one sort field value.

Error: Find criteria must contain at least one sort field value.

What it came down to is that the property was not on the object in the array collection. So the sortField("my property") didn't exist on the object in my array collection. Actually, it did exist in my test data but what had happened was the array in my array collection was replaced with another array of items way before I thought it was. And these items didn't have that property.

No comments

Cannot find when view is not sorted.

Cause
You are trying to create and use a cursor on an ArrayCollection but the sort property is null. Set a breakpoint in your code before the error and check yourArrayCollection.sort property (it will be null).


Problem

Actionscript:
  1. // create cursor to find item
  2. var cursor:IViewCursor = componentInstances.createCursor();
  3. var found:Boolean = cursor.findFirst(item); // error on this line



Solution

Actionscript:
  1. // define a sort on the array collection sort property
  2. // i am doing it on creationComplete in my init() function
  3. // but you can add when you need it
  4. private function init():void {
  5.     // Create the Sort instance.
  6.     var sort:Sort = new Sort();
  7.     // Set the sort field; we are using the default sort value here
  8.     sort.fields = [new SortField(null)];
  9.     // Assign the Sort object to the view.
  10.     componentInstances.sort = sort;
  11.     // Apply the sort to the collection.
  12.     componentInstances.refresh();
  13. }
  14.  
  15. // now this will work
  16. var cursor:IViewCursor = componentInstances.createCursor();
  17. var found:Boolean = cursor.findFirst(item); // study the findFirst method

1 comment

Next Page »