Flash Question

  • Started
  • Last post
  • 3 Responses
  • nearestexit

    I've create a flash movie that I want to turn into a screen saver. One of the things the screen saver will do is break up the stage to a 4x4 grid (the grid will range in size based on the overall monitor resolution). Next a 1x1 block (relative to grid) is created and randomly place in one of the 16 grid areas.

    However, the file seems to create a stage that is larger than the monitor's resolution settings, even though when tracing the results, it gives the proper monitor resolution. Any ideas why? Here's the script:

    // get the system resolution
    stage_x = System.capabilities.screenResolu...
    stage_y = System.capabilities.screenResolu...

    // set new stage dimensions
    fl.getDocumentDOM().width = stage_x;
    fl.getDocumentDOM().height = stage_y;

    trace (stage_x);
    trace (stage_y);

    // set grid element x & y divisions
    smallX=.25*stage_x; // .25 means there will be 4 spaces
    smallY=.25*stage_y;

    trace ("Block Size = " + smallX + " x " + smallY);

    // choose random x & y positioning
    positionX = Math.floor(Math.random()*4);
    trace (positionX);
    positionY = Math.floor(Math.random()*4);
    trace (positionY);

    // create, resize, and reposition block
    _root.createEmptyMovieClip("newB...
    _root.newBlock_mc.attachMovie ("block", "block", 9 );
    _root.newBlock_mc._width=smallX;
    _root.newBlock_mc._height=smallY...
    _root.newBlock_mc._x=smallX*posi...
    _root.newBlock_mc._y=smallY*posi...
    trace (_root.newBlock_mc._x);
    trace (_root.newBlock_mc._y);

  • st33d0

    Used a combination of liquid layout and your method.

    http://www.robotacid.com/misc/fu…

  • nearestexit0

    Actually, I sort of figured it out. My .swf is 800x600. The screen I'm currently on is 1280x1024 but I want the screensaver/swf to work on any size monitor.

    Apparently, the screensaver was keeping my 800x600 .swf centered on screen, but the upper left corner was no longer 0,0 (x,y origin). So, I just had to recalculate the new upper left corner (in my case it was -200, -424).

    Make sense? It barely does to me. Time to go home.

  • st33d0

    I used the noscale method. That way you don't have to do center outwards calculation. Did you even look at my source? It was only about 8 lines of code.

    Nevermind.