[ 
https://issues.apache.org/jira/browse/FLEX-35010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15299949#comment-15299949
 ] 

Judah Frangipane edited comment on FLEX-35010 at 5/25/16 12:28 PM:
-------------------------------------------------------------------

This appears to be an error in the ButtonBarButton class of the Flex SDK. If we 
fix the ButtonBarButton class it should fix this issue. 

When the data property on a ButtonBarButton instance is set it is dispatching a 
generic flash.events.Event with the string parameter of "dataChange" like so: 

{code:ActionScript}
    public function set data(value:Object):void
    {
         content = value;
         dispatchEvent(new Event("dataChange"));
    }
{code}

The ButtonBarButton class expects a mx.events.FlexEvent for "dataChange" events:

{code:ActionScript}
[Event(name="dataChange", type="mx.events.FlexEvent")]
{code}

So the ButtonBarButton data setter should be dispatching a mx.events.FlexEvent 
like so:

{code:ActionScript}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
{code}

instead of the current (line 194):
{code:ActionScript}
dispatchEvent(new Event("dataChange"));
{code}

I'm not able to create a patch at the moment but changing the above code to use 
mx.events.FlexEvent should fix it.

*RichTextEditor Workaround*
As a workaround to get the RichTextEditor to work you can remove the dataChange 
listeners on each of the ButtonBarButtons in the 
spark.skins.richTextEditorClasses.AlignToolSkin class. You will probably have 
to copy the skin class into your project in the same package and location as in 
the Flex SDK (called monkey patching) and then make the following changes:

Before: 
{code:xml}
<fx:Component id="firstButton">
        <s:ButtonBarButton 
skinClass="spark.skins.spark.ButtonBarFirstButtonSkin" 
dataChange="toolTip=data.toolTip"/>
</fx:Component>
{code}

After:
{code:XML}
<fx:Component id="firstButton">
        <s:ButtonBarButton 
skinClass="spark.skins.spark.ButtonBarFirstButtonSkin"/>
</fx:Component>
{code}

Alternatively, you can create your own ButtonBarButton class that has the fixes 
above. 


was (Author: flexcapacitor):
This appears to be an error in the ButtonBarButton class of the Flex SDK. If we 
fix the ButtonBarButton class it should fix this issue. 

When the data property on a ButtonBarButton instance is set it is dispatching a 
generic flash.events.Event with the string parameter of "dataChange" like so: 

{code:ActionScript}
    public function set data(value:Object):void
    {
         content = value;
         dispatchEvent(new Event("dataChange"));
    }
{code}

The ButtonBarButton class expects a mx.events.FlexEvent for "dataChange" events:

{code:ActionScript}
[Event(name="dataChange", type="mx.events.FlexEvent")]
{code}

So the ButtonBarButton data setter should be dispatching a mx.events.FlexEvent 
like so:

{code:ActionScript}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
{code}

instead of the current (line 194):
{code:ActionScript}
dispatchEvent(new Event("dataChange"));
{code}

I'm not able to create a patch at the moment but changing the above code to use 
mx.events.FlexEvent should fix it.

*RichTextEditor Workaround*
As a workaround to get the RichTextEditor to work you can remove the dataChange 
listeners on each of the ButtonBarButtons in the 
spark.skins.richTextEditorClasses.AlignToolSkin class. You will probably have 
to copy the skin class into your project in the same package and location as in 
the Flex SDK (called monkey patching) and then make the following changes:

Before: 
{code:xml}
<fx:Component id="firstButton">
        <s:ButtonBarButton 
skinClass="spark.skins.spark.ButtonBarFirstButtonSkin" 
dataChange="toolTip=data.toolTip"/>
</fx:Component>
{code}

After:
{code:XML}
<fx:Component id="firstButton">
        <s:ButtonBarButton 
skinClass="spark.skins.spark.ButtonBarFirstButtonSkin"/>
</fx:Component>
{code}

> ns:RichTextEditor Error
> -----------------------
>
>                 Key: FLEX-35010
>                 URL: https://issues.apache.org/jira/browse/FLEX-35010
>             Project: Apache Flex
>          Issue Type: Bug
>    Affects Versions: Apache Flex 4.15.0
>            Reporter: Lucas Henrique Bovetto
>              Labels: easyfix, easytest
>
> Error in ns:RichTextEditor component.
> Just put the component in a container and run the programm
> Error Message:
> TypeError: Error #1034: Type Coercion failed: cannot convert 
> flash.events::Event@89817b9 to mx.events.FlexEvent.
>       at flash.events::EventDispatcher/dispatchEventFunction()
>       at flash.events::EventDispatcher/dispatchEvent()
>       at 
> mx.core::UIComponent/dispatchEvent()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:13688]
>       at spark.components::ButtonBarButton/set 
> data()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/ButtonBarButton.as:194]
>       at 
> spark.components::SkinnableDataContainer/updateRenderer()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as:614]
>       at 
> spark.components.supportClasses::ListBase/updateRenderer()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as:1248]
>       at 
> spark.components.supportClasses::ButtonBarBase/updateRenderer()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as:508]
>       at 
> spark.components::DataGroup/setUpItemRenderer()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/DataGroup.as:1162]
>       at 
> spark.components::DataGroup/http://www.adobe.com/2006/flex/mx/internal::itemAdded()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/DataGroup.as:1706]
>       at 
> spark.components::DataGroup/createItemRenderers()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/DataGroup.as:1062]
>       at 
> spark.components::DataGroup/commitProperties()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/spark/src/spark/components/DataGroup.as:1091]
>       at 
> mx.core::UIComponent/validateProperties()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:8751]
>       at 
> mx.managers::LayoutManager/validateProperties()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:605]
>       at 
> mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:821]
>       at 
> mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to