#1
  1. Coding fun is drunk
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Lincoln, UK
    Posts
    127
    Rep Power
    22
    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"
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    6
    Rep 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);
  4. #3
  5. film at 11
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    413
    Rep Power
    14
    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
    }
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    6
    Rep Power
    0

    Yes, you are right merkinmuffley - I always forget about this one!


    Yes, you are right merkinmuffley - I always forget about this one!
  8. #5
  9. Coding fun is drunk
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Lincoln, UK
    Posts
    127
    Rep Power
    22
    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?
    "The cause will equal the effect after the effect has preceded the cause"
  10. #6
  11. film at 11
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    413
    Rep Power
    14
    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.

IMN logo majestic logo threadwatch logo seochat tools logo