The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
Javascript masters only please.
Discuss Javascript masters only please. in the JavaScript Development forum on Dev Shed. Javascript masters only please. JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 14th, 2001, 04:51 AM
|
 |
Coding fun is drunk
|
|
Join Date: Jan 2001
Location: Lincoln, UK
|
|
|
Sorry about the title but it got you attention didnt it!
What i want to do is dynamically alter the size of a pop up window,
so when the user clicks on a link, the popup window opens, i have a flash file in the pop up whih will be exactley 100% x 100%, in the flash file i have a game, and what i want to do, is in the game, when a character moves to the edge of the screen (say the left) i want the whole of the pop up window to move to the left a couple of pixels. I know how to do the flash side of things, (if your wondering i'll do a hit test with an fscommand), but how o i dynamically set the window placement on the screen,
I know this isnt code of any sort but maybe it will help you get a idea of what i want to do
window.placement()=100,100
if hit left= true
set window.placement() *move whole window left 1 pixel*
if hit right= true
set window.placement() *move whole window right 1 pixel*
if hit up= true
set window.placement() *move whole window up 1 pixel*
if hit down= true
set window.placement() *move whole window down 1 pixel*
can any1 help?
__________________
"The cause will equal the effect after the effect has preceded the cause"
|

March 14th, 2001, 04:52 PM
|
|
Member
|
|
Join Date: Nov 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Can I try - even if I am not a master?
I think the solution for your problem is quite simple - the moveTo() method of window object. You have to keep track of your coordinates and just to add 1 to it.
the code I can thing of is:
my_x += 1;
window.moveTo(my_x,my_y);
|

March 14th, 2001, 05:12 PM
|
 |
film at 11
|
|
Join Date: Aug 2000
Location: Portland, OR
Posts: 413
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
moveBy will also work, and you don't have to know the exact position on the screen you want to move the window to.
if (self.moveBy)
{
self.moveBy(1,0); // moves the window 1 pixel to the right
}
|

March 14th, 2001, 06:12 PM
|
|
Member
|
|
Join Date: Nov 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Yes, you are right merkinmuffley - I always forget about this one!
Yes, you are right merkinmuffley - I always forget about this one!
|

March 15th, 2001, 03:15 AM
|
 |
Coding fun is drunk
|
|
Join Date: Jan 2001
Location: Lincoln, UK
|
|
|
thanx for the help guys..
ND THIS NEXT QUESTION MITE SOUND STUPID, but if i use self.moveby how do i get it to move up and down?
|

March 15th, 2001, 10:07 AM
|
 |
film at 11
|
|
Join Date: Aug 2000
Location: Portland, OR
Posts: 413
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
moveBy(x, y)
x is horizontal movement and y is vertical movement. positive x moves to the right, and positive y moves down. think of the first quadrant (upper right) of a graph, but this graph is flipped upside-down, so the origin (0, 0) is in the upper lefthand corner instead of the lower left.
so, you could use self.moveTo(0,0) to put the upper left corner of the window in the upper left corner of the screen.
a cool trick is to move the window entirely off the screen and make the user figure out where it went. you could do this by using self.moveBy(-1000, 0), for example.
fyi, none of this works if the page is in a frame, because the "self" window doesn't have all the properties and abilities of a real window.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|