[flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
It doesn't seem that skinning is something that Adobe considered would need to be done in a skin class, for an item renderer. But, you can apply a skin class to them if desired. At each level: GroupBase, Group, DataRenderer, and finally ItemRenderer, you get additional functionality; and consequently, a little more overhead. For instance, if you used ItemRenderer instead of UIComponent, you could use the "hovered" state to control the visibility of the button. However, I think that you're going about it the most efficient way in creating AS item renderers instead of mxml; especially for ADG. -TH --- In flexcoders@yahoogroups.com, Nick Middleweek wrote: > > Thanks for the tip... > > If I bumped up to GroupBase, does that mean I can use Spark skinning as well > or is this not related? > > > > > > > On 6 September 2011 16:31, turbo_vb wrote: > > > ** > > > > > > You might try bumping up from UIComponent to GroupBase and set > > mouseEnabledWhereTransparent = true; > > > > -TH > > > > > > --- In flexcoders@yahoogroups.com, Alex Harui wrote: > > > > > > Something has to draw onto every pixel, otherwise the mouse hit passes > > through to underneath. You can set the alpha to 0 and it will still work. > > You can also set background=true and pick a backgroundColor on the TextField > > and not have to draw the fill. > > > > > > > > > On 9/6/11 2:18 AM, "Nick Middleweek" wrote: > > > > > > > > > > > > > > > > > > > > > OK, well I've settled with the white background for now... > > > > > > > > > > > > > > > > > > On 5 September 2011 11:36, Nick Middleweek wrote: > > > Hi, > > > > > > We're using Flex 4 and have an Item Renderer that extends UIComponent. > > > > > > We're adding a TextField that's added in createChildren(). > > > > > > In the Constructor(), I'm adding the listener: > > > > > > this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); > > > > > > > > > ...And in the listener function, I'm adding a button: > > > > > > indicator = new Button(); > > > indicator.width = 20; > > > indicator.height = 20; > > > indicator.label = "..."; > > > this.addChild(indicator); > > > > > > this.invalidateDisplayList(); > > > > > > > > > The problem is that the MouseOver event is ONLY firing when I mouse over > > the TextField and not the 'background' of the IR. > > > > > > If I draw a rectangle in updateDisplayList: > > > > > > // draw rect > > > this.graphics.beginFill(0xFF, 1); > > > this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); > > > this.graphics.endFill(); > > > > > > ... the MouseOver event DOES fire on the red background. > > > > > > Is there a way of achieving this without drawing a rectangle? I did think > > of setting the rect to white but this doesn't seem like the correct > > approach. > > > > > > > > > Thanks for any help... > > > > > > Nick > > > > > > > > > -- > > > Alex Harui > > > Flex SDK Team > > > Adobe System, Inc. > > > http://blogs.adobe.com/aharui > > > > > > > > > >
Re: [flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
Thanks for the tip... If I bumped up to GroupBase, does that mean I can use Spark skinning as well or is this not related? On 6 September 2011 16:31, turbo_vb wrote: > ** > > > You might try bumping up from UIComponent to GroupBase and set > mouseEnabledWhereTransparent = true; > > -TH > > > --- In flexcoders@yahoogroups.com, Alex Harui wrote: > > > > Something has to draw onto every pixel, otherwise the mouse hit passes > through to underneath. You can set the alpha to 0 and it will still work. > You can also set background=true and pick a backgroundColor on the TextField > and not have to draw the fill. > > > > > > On 9/6/11 2:18 AM, "Nick Middleweek" wrote: > > > > > > > > > > > > > > OK, well I've settled with the white background for now... > > > > > > > > > > > > On 5 September 2011 11:36, Nick Middleweek wrote: > > Hi, > > > > We're using Flex 4 and have an Item Renderer that extends UIComponent. > > > > We're adding a TextField that's added in createChildren(). > > > > In the Constructor(), I'm adding the listener: > > > > this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); > > > > > > ...And in the listener function, I'm adding a button: > > > > indicator = new Button(); > > indicator.width = 20; > > indicator.height = 20; > > indicator.label = "..."; > > this.addChild(indicator); > > > > this.invalidateDisplayList(); > > > > > > The problem is that the MouseOver event is ONLY firing when I mouse over > the TextField and not the 'background' of the IR. > > > > If I draw a rectangle in updateDisplayList: > > > > // draw rect > > this.graphics.beginFill(0xFF, 1); > > this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); > > this.graphics.endFill(); > > > > ... the MouseOver event DOES fire on the red background. > > > > Is there a way of achieving this without drawing a rectangle? I did think > of setting the rect to white but this doesn't seem like the correct > approach. > > > > > > Thanks for any help... > > > > Nick > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > > > >
Re: [flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
brilliant, this worked: this.graphics.beginFill(0xFF, 0); // zero = alpha off. Thanks! On 6 September 2011 15:54, Alex Harui wrote: > ** > > > Something has to draw onto every pixel, otherwise the mouse hit passes > through to underneath. You can set the alpha to 0 and it will still work. > You can also set background=true and pick a backgroundColor on the > TextField and not have to draw the fill. > > > > On 9/6/11 2:18 AM, "Nick Middleweek" wrote: > > > > > > > OK, well I've settled with the white background for now... > > > > > > On 5 September 2011 11:36, Nick Middleweek wrote: > > Hi, > > We're using Flex 4 and have an Item Renderer that extends UIComponent. > > We're adding a TextField that's added in createChildren(). > > In the Constructor(), I'm adding the listener: > > this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); > > > ...And in the listener function, I'm adding a button: > > indicator = new Button(); > indicator.width = 20; > indicator.height = 20; > indicator.label = "..."; > this.addChild(indicator); > > this.invalidateDisplayList(); > > > The problem is that the MouseOver event is ONLY firing when I mouse over > the TextField and not the 'background' of the IR. > > If I draw a rectangle in updateDisplayList: > > // draw rect > this.graphics.beginFill(0xFF, 1); > this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); > this.graphics.endFill(); > > ... the MouseOver event DOES fire on the red background. > > Is there a way of achieving this without drawing a rectangle? I did think > of setting the rect to white but this doesn't seem like the correct > approach. > > > Thanks for any help... > > Nick > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui > > > -- Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 035 5424, blog: http://www.middleweek.co.uk } );
[flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
You might try bumping up from UIComponent to GroupBase and set mouseEnabledWhereTransparent = true; -TH --- In flexcoders@yahoogroups.com, Alex Harui wrote: > > Something has to draw onto every pixel, otherwise the mouse hit passes > through to underneath. You can set the alpha to 0 and it will still work. > You can also set background=true and pick a backgroundColor on the TextField > and not have to draw the fill. > > > On 9/6/11 2:18 AM, "Nick Middleweek" wrote: > > > > > > > OK, well I've settled with the white background for now... > > > > > > On 5 September 2011 11:36, Nick Middleweek wrote: > Hi, > > We're using Flex 4 and have an Item Renderer that extends UIComponent. > > We're adding a TextField that's added in createChildren(). > > In the Constructor(), I'm adding the listener: > >this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); > > > ...And in the listener function, I'm adding a button: > >indicator = new Button(); > indicator.width = 20; > indicator.height = 20; > indicator.label = "..."; > this.addChild(indicator); > > this.invalidateDisplayList(); > > > The problem is that the MouseOver event is ONLY firing when I mouse over the > TextField and not the 'background' of the IR. > > If I draw a rectangle in updateDisplayList: > >// draw rect > this.graphics.beginFill(0xFF, 1); > this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); > this.graphics.endFill(); > > ... the MouseOver event DOES fire on the red background. > > Is there a way of achieving this without drawing a rectangle? I did think of > setting the rect to white but this doesn't seem like the correct approach. > > > Thanks for any help... > > Nick > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui >
Re: [flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
Something has to draw onto every pixel, otherwise the mouse hit passes through to underneath. You can set the alpha to 0 and it will still work. You can also set background=true and pick a backgroundColor on the TextField and not have to draw the fill. On 9/6/11 2:18 AM, "Nick Middleweek" wrote: OK, well I've settled with the white background for now... On 5 September 2011 11:36, Nick Middleweek wrote: Hi, We're using Flex 4 and have an Item Renderer that extends UIComponent. We're adding a TextField that's added in createChildren(). In the Constructor(), I'm adding the listener: this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); ...And in the listener function, I'm adding a button: indicator = new Button(); indicator.width = 20; indicator.height = 20; indicator.label = "..."; this.addChild(indicator); this.invalidateDisplayList(); The problem is that the MouseOver event is ONLY firing when I mouse over the TextField and not the 'background' of the IR. If I draw a rectangle in updateDisplayList: // draw rect this.graphics.beginFill(0xFF, 1); this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); this.graphics.endFill(); ... the MouseOver event DOES fire on the red background. Is there a way of achieving this without drawing a rectangle? I did think of setting the rect to white but this doesn't seem like the correct approach. Thanks for any help... Nick -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Flex 4: MouseOver not firing on a UIComponent Item Renderer
OK, well I've settled with the white background for now... On 5 September 2011 11:36, Nick Middleweek wrote: > Hi, > > We're using Flex 4 and have an Item Renderer that extends UIComponent. > > We're adding a TextField that's added in createChildren(). > > In the Constructor(), I'm adding the listener: > > this.addEventListener(MouseEvent.MOUSE_OVER, this_onMouseOver); > > > ...And in the listener function, I'm adding a button: > > indicator = new Button(); > indicator.width = 20; > indicator.height = 20; > indicator.label = "..."; > this.addChild(indicator); > > this.invalidateDisplayList(); > > > The problem is that the MouseOver event is ONLY firing when I mouse over > the TextField and not the 'background' of the IR. > > If I draw a rectangle in updateDisplayList: > > // draw rect > this.graphics.beginFill(0xFF, 1); > this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); > this.graphics.endFill(); > > ... the MouseOver event DOES fire on the red background. > > Is there a way of achieving this without drawing a rectangle? I did think > of setting the rect to white but this doesn't seem like the correct > approach. > > > Thanks for any help... > > Nick > > > -- > Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 > 035 5424 } ); > > -- Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774 035 5424, blog: http://www.middleweek.co.uk } );