What steps will reproduce the problem?
1.
I have discoved that when the first page of the pdf is not a full page, like
half page, if you click the nextPgae and prePage arrows, the page number shown
on the textInput filed will be wrong.
What is the expected output? What do you see instead?
when I click the nextPage I want go to page + 1, but it shows page + 3 or page +5.
I try it, and find out that when i click the nextPage continuously, the page number changes like 1,2,3,4,5,8,13,19,27...
What version of the product are you using? On what operating system?
I use flex sdk 3.5 and the source code 4.0 from this svn repository.
Please provide any additional information below.
I have read the source code, and I find code that causes that problem. And also, I change the code the make it work well.
following are the code causes the problem and the code I write to resolve this
bug.
package com.devaldi.controls.flexpaper
Line 727 - 748
if(_pageList.length>1)
{
perH=_pageList[1].y-_pageList[0].y;
var nowP:Number=_paperContainer.verticalScrollPosition/(perH);
if(0<nowP<0.5)
p = 1;
else if(nowP>=(_pageList.length-0.5)&&nowP<=_pageList.length)
p = _pageList.length;
else{
p = Math.round(nowP)+1;
if(_pageList.length>p-1&&_paperContainer.verticalScrollPosition<_pageList[p-1].y && p!=_pageList.length){
p-=1;
}
}
bFoundFirst = true;
}
else
{
bFoundFirst = true;
p = 1;
}
The working code I write is:
if(_pageList.length>1)
{
var middle:int = 0;
for(var j:int=0;j<_pageList.length-1;j++){
if( _paperContainer.verticalScrollPosition < ( middle + ( _pageList[j+1].y - _pageList[j].y )/2 ) ){
break;
}
middle += _pageList[j+1].y - _pageList[j].y;
if( j == _pageList.length){
break;
}
}
p = j + 1;
bFoundFirst = true;
}
else
{
bFoundFirst = true;
p = 1;
}
Thanks.
Original issue reported on code.google.com by yankaili...@gmail.com on 24 Feb 2011 at 5:41
Original issue reported on code.google.com by
yankaili...@gmail.com
on 24 Feb 2011 at 5:41