You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mo...@comcast.net on 2013/12/06 16:35:04 UTC
error overriding mx_internal method setSelectedIndex()
I'm trying to adopt the source code from here
http://flexponential.com/2010/01/31/spark-dropdownlist-equivalent-of-the-html-optgroup-concept/
to disable some items in a drop down list. In the OptgroupDropDownList.as file I'm getting this compile error using the 4.11 SDK:
"Method marked override must override another method."
on this line of code:
override mx_internal function setSelectedIndex(value:int, dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
I wonder if anything has changed in the SDK since the original blog posting that gives rise to this error?
When I go to mx.core.mx_internal, there's not much code there. If I remove "override" it compiles and runs (interestingly, the similar line of code for overriding setSelectedIndices() doesn't give a compile error), but this doesn't result in the correct functionality (I guess, as expected, without a proper override). Any feedback appreciated.
Re: error overriding mx_internal method setSelectedIndex()
Posted by mo...@comcast.net.
Thanks so much Mark, for that great explanation. It really helps!
----- Original Message -----
From: "Kessler CTR Mark J" <ma...@usmc.mil>
To: users@flex.apache.org
Sent: Friday, December 6, 2013 9:24:36 AM
Subject: RE: error overriding mx_internal method setSelectedIndex()
It was changed around 4.10 [1] . The change to public enabled a common method between the listbase components and the grid/datagrid components. This change supported a new interface that implements a simple navigation that can be commonly used between those components [2].
No mx_internal is required for that method now to override it. It should work like this now...
override public function setSelectedIndex(rowIndex:int, dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
{
super. setSelectedIndex (rowIndex, dispatchChangeEvent, changeCaret);
}
[1] http://flex.apache.org/asdoc/spark/components/supportClasses/ListBase.html#setSelectedIndex()
[2] http://flex.apache.org/asdoc/spark/components/supportClasses/IDataProviderEnhance.html
-Mark
RE: error overriding mx_internal method setSelectedIndex()
Posted by Kessler CTR Mark J <ma...@usmc.mil>.
It was changed around 4.10 [1] . The change to public enabled a common method between the listbase components and the grid/datagrid components. This change supported a new interface that implements a simple navigation that can be commonly used between those components [2].
No mx_internal is required for that method now to override it. It should work like this now...
override public function setSelectedIndex(rowIndex:int, dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
{
super. setSelectedIndex (rowIndex, dispatchChangeEvent, changeCaret);
}
[1] http://flex.apache.org/asdoc/spark/components/supportClasses/ListBase.html#setSelectedIndex()
[2] http://flex.apache.org/asdoc/spark/components/supportClasses/IDataProviderEnhance.html
-Mark
Re: error overriding mx_internal method setSelectedIndex()
Posted by mo...@comcast.net.
Thanks Alex, what does that mean? (how to change the code?) I've never used mx_internal before...
In doing more research I found this link:
http://winxalex.blogspot.com/2012/06/override-mxinternal-function-error-1004.html
which agrees with last entry in this link:
http://forums.adobe.com/message/2966061
but adjusting the code as follows:
//import mx.core.mx_internal;
//use namespace mx_internal;
public namespace mx_internal="http://www.adobe.com/2006/flex/mx/internal";
public class OptgroupDropDownList extends DropDownList
{
override mx_internal function setSelectedIndex(value:int, dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
{
...
gives this compile error: "A file found in a source-path can not have more than one externally visible definition. com.mycompany.views.components:mx_internal; com.mycompany.views.components:OptgroupDropDownList"
----- Original Message -----
From: "Alex Harui" <ah...@adobe.com>
To: users@flex.apache.org
Sent: Friday, December 6, 2013 8:03:47 AM
Subject: Re: error overriding mx_internal method setSelectedIndex()
Pretty sure in 4.11 that method became public.
On 12/6/13 7:35 AM, "modjklist@comcast.net" <mo...@comcast.net> wrote:
>I'm trying to adopt the source code from here
>
>http://flexponential.com/2010/01/31/spark-dropdownlist-equivalent-of-the-h
>tml-optgroup-concept/
>
>to disable some items in a drop down list. In the OptgroupDropDownList.as
>file I'm getting this compile error using the 4.11 SDK:
>
>"Method marked override must override another method."
>
>on this line of code:
>
>override mx_internal function setSelectedIndex(value:int,
>dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
>
>I wonder if anything has changed in the SDK since the original blog
>posting that gives rise to this error?
>
>When I go to mx.core.mx_internal, there's not much code there. If I
>remove "override" it compiles and runs (interestingly, the similar line
>of code for overriding setSelectedIndices() doesn't give a compile
>error), but this doesn't result in the correct functionality (I guess, as
>expected, without a proper override). Any feedback appreciated.
>
Re: error overriding mx_internal method setSelectedIndex()
Posted by Alex Harui <ah...@adobe.com>.
Pretty sure in 4.11 that method became public.
On 12/6/13 7:35 AM, "modjklist@comcast.net" <mo...@comcast.net> wrote:
>I'm trying to adopt the source code from here
>
>http://flexponential.com/2010/01/31/spark-dropdownlist-equivalent-of-the-h
>tml-optgroup-concept/
>
>to disable some items in a drop down list. In the OptgroupDropDownList.as
>file I'm getting this compile error using the 4.11 SDK:
>
>"Method marked override must override another method."
>
>on this line of code:
>
>override mx_internal function setSelectedIndex(value:int,
>dispatchChangeEvent:Boolean = false, changeCaret:Boolean = true):void
>
>I wonder if anything has changed in the SDK since the original blog
>posting that gives rise to this error?
>
>When I go to mx.core.mx_internal, there's not much code there. If I
>remove "override" it compiles and runs (interestingly, the similar line
>of code for overriding setSelectedIndices() doesn't give a compile
>error), but this doesn't result in the correct functionality (I guess, as
>expected, without a proper override). Any feedback appreciated.
>