View Full Version : Restricting Window movement
SunRei
01-10-2006, 10:46 PM
Hey There...
Need Help! I'm having some trouble with scripting to confine a dynamically generated window within the confines of it's parent window.
I can modify the Flash MX mx.containers.window class so that the window isn't draggable at all by modifying the startDragging function, but I just want to confine the window, not make it totally stationary!
Thanks!
Rei
Cyber-Drugs
01-10-2006, 10:59 PM
Is this maybe what you want? Read page two...
http://www.actionscript.org/tutorials/beginner/drag-n-drop/index.shtml
SunRei
01-11-2006, 01:04 AM
Hello and thanks for replying to me! :)
I have tried just confining the window using -on- but no go...I don't think it works because the window isn't instantiated that way..or something like.
The window is an instance of the mx.managers.PopUpManager.createPopUp class, and after setting the properties of the window I can modify some of the functions in the mx.containers.window class to stop the window from moving (by removing the contents of the entire startDragging function).
This is the class code that I need to change to restrict the draggable area (I think!). But I'm not sure which parameters need changing!
function startDragging (Void) : Void {
if (this.modalWindow == undefined){
var o = this._parent.createChildAtDepth("BoundingBox", DepthManager.kTop, {_visible:false});
this.swapDepths(o);
o.removeMovieClip();
}
regX = _xmouse;
regY = _ymouse;
onMouseMove = dragTracking;
}
function stopDragging(Void) : Void {
delete onMouseMove;
}
function dragTracking(Void) : Void {
move(_parent._xmouse - regX, _parent._ymouse - regY);
updateAfterEvent();
}
};
If I take all of the code out of the startDragging function, the window become stationary, which is cool but not what I want. Any other suggestions would be awesome!
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.