HTMLElement is only visible to JS targets so you need to wrap that up in a 
COMPILE::JS clause, e.g.

COMPILE::JS {
           var scrollArea:HTMLElement = listArea.element;
var oldScroll:Number = scrollArea.scrollTop;

            var rowHeight:Number = _presentationModel.rowHeight;
            var totalHeight:Number = sharedModel.dataProvider.length *
rowHeight - scrollArea.clientHeight;

            scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);

return oldScroll != scrollArea.scrollTop;

}

COMPILE::SWF {
           (…) // Jewel doesn’t really do swf, so maybe leave this out
           return false; // or true, a long as it’s a Boolean
}

From: Hugo Ferreira<mailto:hferreira...@gmail.com>
Sent: Sunday, March 27, 2022 2:46 PM
To: Apache Royale Development<mailto:dev@royale.apache.org>
Subject: Strang error: I don't know what to import

Hi,

I added this method to DataGridView.as

  public function scrollToIndex(index:int):Boolean
{
if (index == -1) return false;

var scrollArea:HTMLElement = listArea.element;
var oldScroll:Number = scrollArea.scrollTop;

            var rowHeight:Number = _presentationModel.rowHeight;
            var totalHeight:Number = sharedModel.dataProvider.length *
rowHeight - scrollArea.clientHeight;

            scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);

return oldScroll != scrollArea.scrollTop;
}

When I try to compile (with ANT as always I do), I get this error:

[java]
/Volumes/Data/SDK/apache-royale-src/apache-royale/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as(191):
col: 19 Error: Type was not found or was not a compile-time constant:
HTMLElement.

     [java]

     [java] var scrollArea:HTMLElement = listArea.element;

     [java]


The similar method works with ListView.as

Reply via email to