PDA

Volledige versie bekijken : terug naar bovengaan in page


LLMM
%Europe/Berlin %963 %2011, 23:07
Hoi,

ik heb een ViewStack met verschillende NavigatorContent(page),
De één page maakt gebruik van scrollbar, als ik dan naar beneden scroll
en wissel dan naar een volgende pagina blijft ie op de vorige scroll positie staan !

hoe kan ik in actionscript zeggen voor terug naar "on top" te gaan.

A.Dres
%Europe/Berlin %855 %2011, 20:31
myObj.verticalScrollPosition = 0;

LLMM
%Europe/Berlin %990 %2011, 23:45
dank je A.Dres
lukt niet echt ...

hier een beetje code wat ik doe
In de mxml <StrucViews:Home wordt er een een functie doorgestuurd loadAllMusic="showTab('2')" naar actionscript code


<s:VGroup id="myGroup" width="805" height="100%" styleName="border" horizontalCenter="0" horizontalScrollPosition="0">

<mx:ApplicationControlBar width="800" height="62">
<mx:Image id="imgLogo" width="615" source="Image/famous.png" height="58" scaleContent="false"/>
</mx:ApplicationControlBar>

<mx:ToggleButtonBar id="btPage" height="32" dataProvider="{viewstack1}" itemClick="clickHandler(event)"
width="802" horizontalGap="2" color="#FFFFFF" buttonWidth="100"/>

<mx:ViewStack id="viewstack1" width="100%" height="100%" creationPolicy="all">
<s:NavigatorContent id="myHome" label="Home" width="100%" height="100%" showEffect="{show}" hideEffect="{hide}">
<StrucViews:Home id="Home" height="100%" width="800" y="-5" horizontalCenter="0" loadAllMusic="showTab('2')"
loadAllPic="showTab('3')" />
</s:NavigatorContent>
actionscript code

protected function showTab(str:String):void
{
switch (str)
{
case '1':viewstack1.selectedIndex = 1; trace("1");break;
case '2':viewstack1.selectedIndex = 2; trace("2");break;
case '3':viewstack1.selectedIndex = 3; trace("3");break;
}

//show tab
//this.screen.top = 0.0;

myGroup.verticalScrollPosition = 0;
myGroup.validateNow();
}

A.Dres
%Europe/Berlin %882 %2011, 21:10
Staat je script blok in de main.mxml

vanuit een class:
mx.core.Application.application.myObj.verticalScro llPosition = 0;

klopt myGroup wel? als ik je code zie verwacht ik eerder viewstack1
mx.core.Application.application.viewstack1.vertica lScrollPosition = 0;

Geen errors in Flex?