Hi all,
Hope someone can help me out with this:
I have an Item() class which creates an ItemInfo() object. The ItemInfo is (for now) just a rect and extends from GestureCore() which contains only the Flick, Rotate & Scale gestures and also holds the bounding areas.
When i flick the ItemInfo without rotating it, it bounces between x=0 and max width of the stage. it all works fine.
Now when i rotate the ItemInfo() 45degree clockwise, it bounces between 3/4 of the stage and -1/4 (out of screen).
Rotating it further to 90degree it bounces between 1/2 of the stage and -1/2(out of screen)
Any of you have bumped on this before?
some code of the boundings
public function onEnterFrameHandler(evt:Event):void
{
//-------------------------------------------------------------------------------
//Watch bounds for collision
trace("breedte in COre"+this.width, Xpos);
if(this.x <= 0-Xpos)
{
this.x = 0-Xpos;
dx =- dx;
}
if( this.x >= _stage.stageWidth-this.width-Xpos )
{
this.x = _stage.stageWidth-this.width-Xpos ;
dx =- dx;
}
if(this.y <= 0-Ypos)
{
this.y = 0-Ypos;
dy =- dy;
}
if( this.y >= _stage.stageHeight-this.height -Ypos )
{
this.y = _stage.stageHeight-this.height -Ypos;
dy =- dy;
}
if((Math.abs(dy) <= 1) && (Math.abs(dx) <= 1))
{
dx = 0;
dy = 0;
removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
else
{
this.x += dx;
this.y += dy;
dx*=friction;
dy*=friction;
}
}