Hi,

When a drag-n-drop operation is made, the data setter is not fired, 
rather the data changeEvent.
I think that the problem is with your itemRenderer - you have 
overriden the data setter but you didn't add an event listener for 
dataChange events.
Try to add a Flex.DataChangeEvent listener that does exactly what 
the setter does.

Hope it helps
Josef

--- In [email protected], "icepaco33" <[EMAIL PROTECTED]> wrote:
>
> Humble excuse Alex,
> but you are not answering my question / problem.
> 
> I have no problem with my highlight / selection showing...
> My problem is that if I do drag & drop operation and if I change 
the
> Data Provider then sometimes I can no longer select some items even
> tho they are showing...
> 
> I have found out that if I remove my Highlighter class from my
> renderer then everything will work out fine (I can drag & drop and
> then select any / every items in the list).
> 
> So I was wondering if it is because my Highlighter class isn't
> implementing some Interface that are necessary for a sub component 
of
> a Renderer...
> 
> Thanx !
> --- In [email protected], "Alex Harui" <aharui@> wrote:
> >
> > The Flex classes draw highlight and selection behind the 
renderer, so
> > any renderer with an opaque background will obscure it.  Folks 
either
> > test for isItemSelected/Highlighted and change their own 
background
> > color, or remove the background color.  You can see examples on 
my blog
> > (blogs.adobe.com/aharui
> > 
> >  
> > 
> > ________________________________
> > 
> > From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> > Behalf Of icepaco33
> > Sent: Monday, November 12, 2007 9:22 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: Can't select an item renderer in a list
> > 
> >  
> > 
> > Salutations,
> > I have found out the culprit.
> > So first here is the code of the renderer :
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
> > <http://www.adobe.com/2006/mxml> " width="100%"
> > styleName="myStyle1" verticalScrollPolicy="off"
> > implements="mx.managers.IFocusManagerComponent" 
toolTip="{data.uid}"
> > creationComplete="SentenceRendererCreationCompleteEventHandler
()">
> > <mx:states>
> > <mx:State name="BeingPlayed">
> > <mx:SetStyle target="{txtSentence}" name="color" 
value="#ff0000"/>
> > </mx:State>
> > <mx:State name="Selected">
> > <mx:SetProperty target="{txtSentence}" name="condenseWhite"
> > value="false"/>
> > <mx:SetEventHandler name="currentStateChange">
> > 
> > 
<mx:handler>SentenceRendererSelectedCurrentStateChangeEventHandler()
</mx
> > :handler>
> > </mx:SetEventHandler>
> > </mx:State>
> > <mx:State name="HasBeenPlayed">
> > <mx:SetStyle target="{txtSentence}" name="color" 
value="#808080"/>
> > <mx:SetStyle name="themeColor"/>
> > </mx:State>
> > </mx:states>
> > <mx:Style source="Ressources/Librairie/USlicFont.css"/>
> > <mx:TextArea id="txtSentence" wordWrap="true" width="90%"
> > borderStyle="none" text="{data.Text}" textIndent="25"
> > styleName="myStyle1" textDecoration="none" selectable="false"
> > verticalScrollPolicy="off" minHeight="60"> 
> > </mx:TextArea>
> > <mx:Button id="btnSentence" width="25" label="S{data.indexNo}"
> > height="15" color="#ffffff">
> > 
> > <mx:downSkin>@Embed('Ressources/Librairie/History/Btn_S_D.swf')
</mx:down
> > Skin>
> > 
> > <mx:overSkin>@Embed('Ressources/Librairie/History/Btn_S_U.swf')
</mx:over
> > Skin>
> > 
> > <mx:upSkin>@Embed('Ressources/Librairie/History/Btn_S_U.swf')
</mx:upSkin
> > >
> > </mx:Button>
> > <mx:Script>
> > <![CDATA[
> > import text.Highlighter; 
> > private var _Highlighter:Highlighter;
> > private var _strDefaultState:String = "non";
> > 
> > override public function set data(value:Object):void
> > {
> > super.data = value;
> > if(this.currentState == "Selected")
> > {
> > _Highlighter.reset(); 
> > _Highlighter.highlightText(); 
> > }
> > } 
> > public function BeingPlayed():void
> > {
> > //Change the text color
> > _strDefaultState = currentState;
> > _Highlighter.reset(); 
> > this.currentState = "BeingPlayed"; 
> > }
> > public function HasBeenPlayed():void
> > {
> > //Change the text color
> > _Highlighter.reset(); 
> > this.currentState = "HasBeenPlayed";
> > }
> > public function HasBeenSelected():void
> > {
> > this.currentState = "Selected";
> > }
> > public function ResetRenderer():void
> > {
> > if(_strDefaultState != "non")
> > {
> > _Highlighter.reset(); 
> > currentState=_strDefaultState;
> > _strDefaultState = "non";
> > }
> > }
> > public function BackToDefault():void
> > {
> > _Highlighter.reset(); 
> > currentState = "";
> > }
> > private function getTextField(component:TextArea):TextField{
> > var len:int = component.numChildren;
> > var r:TextField = new TextField(); 
> > for(var i:int=0; i<len; i++){
> > var thisChild:DisplayObject = component.getChildAt(i);
> > if(thisChild is TextField){
> > var textChild:TextField = thisChild as TextField;
> > r = textChild;
> > }
> > }
> > return r;
> > }
> > private function
> > SentenceRendererSelectedCurrentStateChangeEventHandler():void
> > {
> > _Highlighter.highlightText(); 
> > }
> > 
> > private function SentenceRendererCreationCompleteEventHandler
():void
> > {
> > _Highlighter = new Highlighter(getTextField
(txtSentence),0xfffcee21);
> > }
> > 
> > ]]>
> > </mx:Script>
> > </mx:Canvas>
> > 
> > The problem resides in the sub components Highlighter. This 
component
> > draws a rectangle in the back of the text. (This is someone 
else's lib
> > that I modified a bit)
> > 
> > Anyway if I don't refer to this sub class at all then my 
application
> > works fine.
> > 
> > I believe I have to implements some Interface from Flex so that 
I can
> > use this sub class in my Renderer...
> > 
> > Thanx for the help
> > 
> > --- In [email protected] <mailto:flexcoders%
40yahoogroups.com>
> > , "Alex Harui" <aharui@> wrote:
> > >
> > > The UID's in the data, not the renderer matter. Renderers 
definitely
> > > get recycled so you can't store anything about selection in the
> > renderer
> > > and have to use isItemSelected to update it during 
updateDisplayList.
> > > 
> > > 
> > > 
> > > If you want to post a mini-example, we can take a look.
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> > [mailto:[email protected] <mailto:flexcoders%
40yahoogroups.com>
> > ] On
> > > Behalf Of icepaco33
> > > Sent: Sunday, November 11, 2007 4:04 PM
> > > To: [email protected] <mailto:flexcoders%
40yahoogroups.com> 
> > > Subject: [flexcoders] Re: Can't select an item renderer in a 
list
> > > 
> > > 
> > > 
> > > No I do not have the same problem if I use the default 
renderer.
> > > I checked the UIDs in the following manner :
> > > 
> > > - Manually changing the UID of each renderer to make sure they 
are
> > > unique
> > > 
> > > - Using debug mode and monitoring the UID : they are 
different. 
> > > 
> > > In both cases tho the behavior of this bug is exactly the 
same :
> > > 
> > > Behavior of the list during a drag and drop is to create 2 new
> > renderer:
> > > 
> > > 1 that represent the item being dragged which will never make 
it to
> > > the list. (So that new item doesn't cause the bug)
> > > 1 that will take the place of the item that you dragged but 
will
> > > contain the info of the item next to it.
> > > 
> > > That last item for whatever reason will be considerer by the 
list's
> > > selection model as the last item in the list.
> > > 
> > > So while you can still see the other items in the list you can 
no
> > > longer rollover / select them.
> > > 
> > > If I repopulate the list by changing the list's dataProvider 
then for
> > > some reason the list will use the renderer's already there but 
in
> > > reverse order. That means that the first item is selectable 
but none
> > > of the following items will be.(Unless the new list is longer 
than the
> > > old one which means that all the new items which will require 
new
> > > renderers will then be selectable)
> > > 
> > > Hope this help clarify !
> > > 
> > > --- In [email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com>
> > > , "Alex Harui" <aharui@> wrote:
> > > >
> > > > Double check the UIDs. Try using the default renderer and 
see if you
> > > > still have the problem.
> > > > 
> > > > 
> > > > 
> > > > ________________________________
> > > > 
> > > > From: [email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com>
> > > [mailto:[email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com>
> > > ] On
> > > > Behalf Of icepaco33
> > > > Sent: Sunday, November 11, 2007 5:52 AM
> > > > To: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com> 
> > > > Subject: [flexcoders] Can't select an item renderer in a list
> > > > 
> > > > 
> > > > 
> > > > Greetings everybody,
> > > > I have a peculiar problem. I have a list that is rendered by 
a
> > custom
> > > > item renderer. The list allows multiple selection and also 
drag and
> > > > drop operation (in order to shuffle the item around)
> > > > 
> > > > However when I move an item further down the list (drag & 
drop) then
> > I
> > > > can't select the items that are below the item immediately 
following
> > > > the item I moved.
> > > > 
> > > > Also if I change the content of my data provider, I will 
experience
> > > > the same thing (can't select the items except the first one)
> > > > 
> > > > I found out something very interesting :
> > > > It seems that my list doesn't allow me to select items which 
the
> > > > renderer is older (has been instanciated before) the previous
> > > renderer.
> > > > 
> > > > Allow me to demonstrate :
> > > > If I have the following renderers :
> > > > 
> > > > Renderer1
> > > > Renderer2
> > > > Renderer5
> > > > Renderer3
> > > > Renderer4
> > > > 
> > > > And assuming the number after 'renderer' indicates the order 
into
> > > > which the renderer have been instanciated in my list then in 
the
> > above
> > > > situation I will not be able to select or rollover Renderer3 
and
> > > > Renderer4...
> > > > 
> > > > This I believe is the problem that happens when I do a drag 
& drop
> > > > operation and or when I reload my list by changing the
> > DataProvider...
> > > > 
> > > > N.B. : I use only 1 class for my renderer so all renderers 
are of
> > the
> > > > same type. I have also checked their UID and they seem to be
> > distinct
> > > > as far as I can tell...
> > > > 
> > > > Hope you guys can help cuz this is really bothering me...
> > > > 
> > > > Thanx for your attention !
> > > > 
> > > > paco
> > > >
> > >
> >
>


Reply via email to