dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: [RESOLVED] object stuck to the edge of the movie

  1. #21
    Senior Member vladdddd's Avatar
    Join Date
    Aug 2004
    Location
    in space
    Posts
    352
    even so, with the code working, there still is a problem i havent asked about

    when i open the browser window without resizeing it, the clips i center inside the flashmovie are placed wherever i position them when i edited the movie. only when i resize the window they jump to their spot asigned by the code u gave me. is there any way to avoid this, and make the code act since the window is first opend?

  2. #22
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    oops forget that because I simplified things for you
    Code:
    Stage.scaleMode="noScale";
    screen = new Object();
    screen.w = 900;
    screen.h = 600;
    
    list_resize = new Object();
    list_resize.onResize = init_screen();
    Stage.addListener(list_resize);
    
    function init_screen() {
    	//center movieClip
    	var pos = get_pos(Stage.width/2-mc_sample_a._width/2,Stage.height/2-mc_sample_a._height/2);
    	mc_sample_a._x = pos.x;
    	mc_sample_a._y = pos.y;
    	
    	//place this movieCLip in the upper left corner
    	var pos = get_pos(0,0);
    	mc_sample_b._x = pos.x;
    	mc_sample_b._y = pos.y;
    }
    
    //sub function to get the resized coordinates
    get_pos = function(x,y){
    	return( {x:int((screen.w-Stage.width)/2+x) ,y:int((screen.h-Stage.height)/2+y )});
    }
    init_screen();//init the screen 1 time at the beginning
    the bold parts are the new ones,-
    I now created a function that does your placemnt (change it there as you need it) and that function is called each time the window gets resuized + once at the beginning.
    Its best to put the above code not in the first frame but rather in the 2nd or 3rd as the flash player needs to initialize the new stage dimensions (never tried it in the first frame,- maybe that works aswell)
    Last edited by renderhjs; 10-29-2006 at 11:03 AM.

  3. #23
    Senior Member vladdddd's Avatar
    Join Date
    Aug 2004
    Location
    in space
    Posts
    352
    works like a charm

    thank you very much u saved me

  4. #24
    Senior Member vladdddd's Avatar
    Join Date
    Aug 2004
    Location
    in space
    Posts
    352
    hope i m not wrong reopening a [RESOLVED] post

    the thing is i was wondering if there is anyway to keep an object attached to the bottom of the browser s bottom edge withought all this resizeing and stuff. i need a flash page wich has a much bigger hight than the used display rezolution, and i need the browser scroll bar to apear - all this having a menu sticking to the bottom edge while scrolling

    thakns!!!

  5. #25
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    not sure if I understand it in detail,- but you can propably solve it by using a table in html with a fixed height (e.g 2400 pix) and the % width of 100% e.g:
    Code:
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width="100%" height="2400" border="0" cellpadding="0" cellspacing="0">
    and place that swf then inside that table using 100% width and height

    another option would be to set the height of the swf object to absolute (pixel) values and the width to 100%

  6. #26
    Senior Member vladdddd's Avatar
    Join Date
    Aug 2004
    Location
    in space
    Posts
    352
    thanks for the reply!

    i think that the html solution suits me better. i dont want to have script inside my main movie, that adjusts any size or location. if i had this second swf (bottom bar) stuck to the bottom edge by html means, i think i d solve my problem - but when scrolling from the browser will it go over the text and stuff i have in the main sef ???

    i ll have to look up some html tutorials since i m not familiar with dream weaver what so ever

    any tips are welcome

    best rgds!
    vlad
    Last edited by vladdddd; 04-04-2007 at 07:06 PM.

  7. #27
    Junior Member
    Join Date
    Mar 2007
    Posts
    13

    please help :)

    I tried the as you wrote and it works perfectly.

    I also tried to reposition mc_sample_a to bottom left corner with the following as:

    list_resize = new Object();
    list_resize.onResize = function () {

    var pos = get_pos(0,Stage.height-mc_sample_a._height/2);
    mc_sample_a._x = pos.x;
    mc_sample_a._y = pos.y;
    }

    and it works.
    But it only works if I resize the browser and not from the beggining when the movie starts. I tried the thing with the init_screen(); but it's just the oposite that i want. The screen that I get at the beggining is the wrong one, when I resize the window I get the right one. How can I make the initial stage the same as is the one when I resize it? You can check it out what I've done so far on:
    http://cut.si/full/fullpage.html
    (the red cube in bottom is mc_sample_a).

    PLease help!!
    Last edited by johanflash; 06-06-2007 at 02:32 PM.

  8. #28
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    that´s why I declared the repositioning as a function, see:
    http://board.flashkit.com/board/show...8&postcount=22
    ...
    function init_screen() {
    //center movieClip
    ...
    }
    init_screen();//init the screen 1 time at the beginning
    and launched that one at the beginning

  9. #29
    Junior Member
    Join Date
    Mar 2007
    Posts
    13

    Talking tnx for replying so quickly

    First of all I want to thank you!!!

    The thing didn't work as I expected, but then I solved it with swfobject and it works fine I tried many times but now i finally got it to work, so I'm posting 2 versions.

    But there are still 2 small details that seem like a bit of a problem:

    in version 1a you have to resize to get the objects to stick to the edge, after that you can resize all you want and they're sticking all the time.

    Version 2a has another problem: supose I don't have favourites or smth else open on the left of my browser. If I open the page the objects stick to edge right away just like I want them, but if I open my favourites or I simply resize the browser, some of the objects can't be seen because the initial size of the browser was stored.

    Could you pleease look at the file I've posted.
    Do you have any ideas how to solve this???

    You can check out how it looks so far on:
    http://cut.si/full/1/fullpage.html
    http://cut.si/full/2/fullpage.html
    Attached Files Attached Files
    Last edited by johanflash; 06-14-2007 at 10:54 AM. Reason: didn't see the attachments

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center