Hi all,
I am confused ,what’s wrong with this function although it does not cause any errors but my man(player) never stops at the scrolling rightEdge.
RightEdge is the distance from rightside of screen where screen starts to scroll in reverse direction.
I wanna to display it in full screen mode.i.e stage.stageWidth=1276
here rect is the instance name of the big rectangle which consists of all my movieclip,rect.width=9341 & rect.x=-1414.8;
var edgeDistance:Number=200;
function ScrollWithMan()
{
var stagePosition:Number=rect.x + man.mc.x;
var rightEdge:Number=stage.stageWidth-edgeDistance;
var leftEdge:Number=edgeDistance-1250.8;
//trace(stage.stageWidth);
trace("Pos="+ rect.x);
trace("man.x="+man.mc.x);
{
if (stagePosition > rightEdge-100)
{
rect.x-=(stagePosition-rightEdge-100)
if (rect.x < -(rect.width-stage.stageWidth))
rect.x = -(rect.width-stage.stageWidth);
}
else if (stagePosition <leftEdge)
{
rect.x+=(stagePosition-leftEdge);
//if (rect.x < 100) rect.x = 100;
}
}
}