First, describe the work requirements:
As one of the current viewstack pages, rolling news must be refreshed on a regular basis.
I believe it is easy for everyone to implement the simple rolling news effect, but by setting some attributes of move,
// Scroll subtitles
Private function moveaction (): void {
If (recordsnum> default_scroll_rownum ){
Move_up.end (); // it is best to add this sentence; otherwise, it will produce other results when the httpservice refreshes data.
Move_up.yfrom = 0;
Move_up.yto = 0-abfltdg.height;
Move_up.repeatcount = 0; // Loop
Move_up.repeatdelay = 0; // Loop Time
Move_up.duration = speed_scroll * recordsnum; // The Time of scroll once in which speed_scroll,
Recordsnum are all custom variable number types
Move_up.play ();
}
}
<! -- Corresponding page element -->
<Mx: Move id = "move_up" target = "{abfltdg}"/>
<Mx: canvas x = "310" Y = "265" width = "670" Height = "450" id = "canvas_dg" horizontalscrollpolicy = "off" verticalscrollpolicy = "off" Mouseover = "move_pause () "mouseout =" move_resume () "backgroundcolor =" # 90c3fc ">
<Mx: dataGrid x = "0" Y = "0" width = "670" Height = "500" id = "abfltdg" dataprovider = "{fltdata}" verticalscrollpolicy = "off" showheaders = ""false" verticalgridlines = "true" stylename = "abflt" visible = "false" backgroundcolor = "# 90c3fc" backgroundalpha = "0.9">
<Mx: columns>
<Mx: datagridcolumn headertext = "" datafield = "stationname" textalign = "center" fontfamily = "" fontsize = "12" itemrenderer = "Sim. monitor. asobj. custombackgroundcomp "/>
<Mx: datagridcolumn headertext = "flight no." datafield = "fltnumber" textalign = "center" fontfamily = "" fontsize = "12" itemrenderer = "Sim. monitor. asobj. custombackgroundcomp "/>
<Mx: datagridcolumn headertext = "Delay Time" datafield = "delaytime" textalign = "center" fontfamily = "" fontsize = "12" itemrenderer = "Sim. monitor. asobj. custombackgroundcomp "/>
<Mx: datagridcolumn headertext = "cause of delay" datafield = "delayreason" textalign = "center" fontfamily = "" fontsize = "12" itemrenderer = "Sim. monitor. asobj. custombackgroundcomp "/>
</MX: columns>
</MX: DataGrid>
</MX: canvas>
However, in order to regularly refresh viewstack, we need to consider the interface effect:
First, if the refresh time is not considered, the data will be refreshed during the rolling process;
2. If you use the rolling news effect page as an independent control, how can you access it in viewstack and set the component refresh according to the refresh policy each time the scrolling ends;
These two problems are a bit tricky. Fortunately, after thinking and consulting, I think of countermeasures!