You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by chris_d_k <ck...@christiankiefer.de> on 2016/06/23 13:52:34 UTC
Changing dataprovider for buttonbar
Hi,
I have a button bur with a lot of elements, defined like this:
var iconObj:Object;
var icon1:SpriteVisualElement = new Icon1();
icon1.width = trousersIcon.height = 50;
iconObj1= {icon: icon1, label: ""};
in one case I want to add more items, in another less ...
When I add 2 of the items to the dataprovider and change to 3 and back to
the 2 it works.
When I add 9 of the items to the dataprovider and change to 9 others I get
an error.
When I add 10 of the items to the dataprovider and change to 9 others I get
an error.
var collection1:ArrayCollection = new ArrayCollection([iconObj1, iconObj2,
iconObj3, ..., iconObj9 ]);
collection2:ArrayCollection = new ArrayCollection([iconObj1, iconObj2,
iconObj3, ..., iconObj9 , iconObj10]);
The error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of
the caller.
at flash.display::DisplayObjectContainer/removeChild()
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:7365]
at
mx.core::UIComponent/removeChild()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/framework/src/mx/core/UIComponent.as:7272]
at
spark.skins.mobile.supportClasses::ButtonSkinBase/setIcon()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ButtonSkinBase.as:648]
at
spark.skins.mobile.supportClasses::ButtonSkinBase/commitProperties()[/Users/justinmclean/Documents/ApacheFlex4.15/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ButtonSkinBase.as:279]
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]
How can I fix this?
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Changing-dataprovider-for-buttonbar-tp12926.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Changing dataprovider for buttonbar
Posted by Alex Harui <ah...@adobe.com>.
It sounds like icon or button is being re-used and setting to null removes all of them before adding.
Sent from my LG G3, an AT&T 4G LTE smartphone
------ Original message------
From: chris_d_k
Date: Thu, Jun 23, 2016 8:19 AM
To: users@flex.apache.org;
Subject:Re: Changing dataprovider for buttonbar
When I do the following before changing the dataprovider, it works:
buttonBar.dataProvider = null;
buttonBar.validateNow();
Am I doing somthing completely wrong or is that as supposed?
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Changing-dataprovider-for-buttonbar-tp12926p12927.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Changing dataprovider for buttonbar
Posted by chris_d_k <ck...@christiankiefer.de>.
When I do the following before changing the dataprovider, it works:
buttonBar.dataProvider = null;
buttonBar.validateNow();
Am I doing somthing completely wrong or is that as supposed?
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Changing-dataprovider-for-buttonbar-tp12926p12927.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.