Im looking at posting some simple code samples and this was one i was asked for.
Its a simple "center" function. It centers any object in the screen. It can be modified to work across multiple screens (see code).
To use this function simply use the following code:
I dont know if people are interested in these types of "tutorials" but if you are, please let me know of some things you would like to see. Im not sure if this has been posted before (I'm sure it has somewhere).
RomanDA
That's ratehr cool. Thanks!
Sweet David, would that script be like semi-locking something to the center? because that would rock!
i dont know what you mean by "semi-locking".
This moves whatever object you want to the center of the screen.
hehe Ok, fully locking it to the center
just make the object unable to be moved..
*smacks forhead* I'm an idiot.. hehe I've seen that option before
Thanx, David!
What I'd really love.. is an easy to follow tut on making a calendar
Tailsgirl really WILL start ticking if she makes another clock
Here is the easiest tut you will find. Go to Martin's gallery, he has a template there intended for you to use for learning calendars. Use your own graphics, give Martin credit for his script. Easy enough? Hope this helps.
Jim, is that the calendar with the link to the red DX one? there is a missing PNG listed in the tut, and it's too confusing.. I've tried that a dozen times, basically, I edit existing calandars to use myself, but just can't get them right.. I'd like to do one from scratch, with a template included ... hehe well, that wouldn't be from scratch, but a blank template would be nice, I might be able to get somewhere hehehe, love Martin's stuff though
thanks
As a side note:
system.ScreenWidth and system.ScreenHeight can go a bit crazy on multi-monitor setups that dont use a 1-2-3 lineup of monitors. Those only get the width/height of the primary monitor. To determine 'true' width and height on all screens, try using the following:
However, if you're going to do calculations with this full width, you need to take into account that the left-most pixel wont always be at 0. For example my secondary monitor is on my left, not my right, which means that its left-most pixel is at -1680. This means, in order to place the objects properly 'centered' in the full width, you need to use the proper left-value.
After this bit, you still need to do the part that centres the object on that point, but that should get ya started on true positioning on multi-monitor setups.
I use a slightly more complex version in this object: Filler
There are many great features available to you once you register, including:
Sign in or Create Account