A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 45

Thread: HELP: load the movie clip in FIXED size ,but...

  1. #21
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    I've never used stage scaling before, so pardon me if this doesn't work, but the theory seems sound. Doesn't the newly "stretched" stage have a scale value or some width value that you could derive a scale from (based on the known orignal). Then you could inversely apply that same scale to the child photo so that it is appropriately squashed to offset the stage's stretch.

    If the stage happens to stretch to 200% of original, squash the photo within to 50%. If the stage squashed to 50%, stretch the photo to 200%

    Photo scale = 100*(100/stage scale)

    _b

  2. #22
    Member
    Join Date
    Jan 2008
    Posts
    57
    the original stage is set to scaled
    what do you suggest to do?
    set the stage scale to mcs?
    they do whateven the mainpage decided
    how this could be in AS ? (If the stage squashed to 50%, stretch the photo to 200%)
    this yes ,maybe could do the trick ....but how?
    i'm not really good in AS ,i understand that this could happen via listener ..but how??

  3. #23
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    Ok, so you have main.swf and photo.swf, for example. Main.swf is natively 1278 x 900, or whatever. Like gparis stated, flash doesn't include a built in method for scaling an imported swf's stage differently than the loading swf's. The very nature of loading one swf into another dictates that such properties will be inherited. It is unavoidable.

    The hack i'm suggesting may fail if main.swf is scaled smaller than your photo.swf, but oh well.

    Let's assume you're using the MovieClipLoader class to attach photo.swf as its the best practice. So photo.swf is loaded into a movieclip named, say, "content."

    Retooling gparis' code that would sit on main.swf:

    PHP Code:
    sizeListener = new Object();

    //When browser gets resized
    sizeListener.onResize = function() {
    horizScale 100*(Stage.width/1278);
    vertScale 100*(Stage.height/1278);
    content._xscale 100*(100/horizScale);
    content._yscale 100*(100/vertScale;
    };
    Stage.addListener(sizeListener); 
    you'll need to apply the same logic after photo.swf is FINISHED loading too.

    _b
    Last edited by bitsk308; 01-10-2008 at 12:24 PM.

  4. #24
    Member
    Join Date
    Jan 2008
    Posts
    57
    thank you i will try it now and i'll post results!!!

  5. #25
    Member
    Join Date
    Jan 2008
    Posts
    57
    it doesn't work (((
    what i do:
    main movie has 3 frames preloader and then frame 4 movie is loaded and a button to stop
    so i paste the code there:
    sizeListener = new Object();

    //When browser gets resized
    sizeListener.onResize = function() {
    horizScale = 100*(Stage.width/1278);
    vertScale = 100*(Stage.height/1278);
    content._xscale = 100*(100/horizScale);
    content._yscale = 100*(100/vertScale);
    };
    Stage.addListener(sizeListener);

    then i create a mc in the stage with the instance name "content"
    then i load the swf in this mc like this:
    on (press) {
    loadMovie("photo.swf" , "content");
    }
    then i open the photo.fla that has a 3 frames preloader also and at frame 4 the photo loads and stops there so i paste the AS you gave me also there
    i need to remember you that in html the swf is set like this:
    <embed src="main.swf" width="100%" height="100%" quality="high" allowscale="true" scale="exactfit"
    cause i want the main movie to scale
    thanks for trying to help ,if i did something wrong correct me ,if we can try something else ...i'm here for ever unti i fix this..
    at least no strech at wide monitors (width) the photos

  6. #26
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Stage.addListener : Method; detects when a Flash movie is resized if Stage.scaleMode = "noScale" . The addListener method doesn't work with the default movie scaling setting ( "showAll" ) or other scaling settings ( "exactFit" , and "noBorder" ).
    You cannot use that method. You can be successful only if:

    You set the scaleMode to noScale, publish noScale, 100% and margins at 0.
    Put everything (except the container that hosts the picture gallery) into a movieClip named content and use the script i gave you.

    gparis

  7. #27
    Member
    Join Date
    Jan 2008
    Posts
    57
    yes i know my friend but ...
    there is no way to reverse the project now
    and i don't know much of AS in order to scale down (cause are made for 1280x) the swf,s nor either how to position them on screen if the scale move them
    i don't know what i will do for this now i'm testing your random script
    thankz again for you help

  8. #28
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    It seems to me you've worked yourself into a corner with this design. With scale mode set to exactFit, FlashPlayer won't recognize a changing window size as an event, and therefore won't tell flashplayer anything's going on. From what I can tell, and I just spent the last half hour working up an example, it is simply not possible to attain the effect you're after in flash.

    Either you set the mode to noScale, and flash will read a change in window size, but won't scale your background stuff, or you set it to exactfit, and it will scale your background stuff, but won't register the size of the window changing. Why it works like this, I can only guess. It seems like the onResize would be of just as much, if not way more use when the mode is exactFit than when it's noScale, but that's a question for the adobe engineers, not me.

    Besides it would suck to have the text in your menu.swf stretched out right? I think you should consider forgoing this whole background stretches to window size thing and just make the flash piece whatever size you deem appropriate. As a designer, you have to decide what your audience is and try to cater to their majority, whether you like it or not. The other option I see for you is forgoing flash, and using html and css to position the photos where you want on a stretchy background.

    Sorry my hack idea was a dud. Good luck.

  9. #29
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Either you set the mode to noScale, and flash will read a change in window size, but won't scale your background stuff
    not true. If everything is in the content mc, it will scale to fit 100% of the browser. Just like in exactFit, but with the advantage of giving you control.

    gparis

  10. #30
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    and i don't know much of AS in order to scale down (cause are made for 1280x) the swf,s nor either how to position them on screen if the scale move them
    I gave you the code. use it

    You set your Stage to 1024x768. You take your main fla and put everything inside the mc content, and that's about it. Hopefully you don't make references to _root in your main movie.

    gparis

  11. #31
    Member
    Join Date
    Jan 2008
    Posts
    57
    yes i understand now that all the clips will follow what is set in the html and cannot act indiepent if you don't set the main to stage noscale
    but now it's too late
    bitsk308 pm plz your email i want to show you why this cannot move to html ...
    i cannot message you ,i saw your site that is about art so pm me

  12. #32
    Member
    Join Date
    Jan 2008
    Posts
    57
    Quote Originally Posted by gparis
    I gave you the code. use it

    You set your Stage to 1024x768. You take your main fla and put everything inside the mc content, and that's about it. Hopefully you don't make references to _root in your main movie.

    gparis
    yes but my main movie is made in 1278x944 and it will crop
    or you mean to scale down so it fit stage?
    and then i must do it to every swf that will load?
    this thing to load the main.swf in a mc with noscale was the 1st thing i tried
    but somewhere i lost ..because i load the swfs in 4 different levels ,and 2 containers also
    so it's about 60+ of them...
    i know that there must be a short way for this ,maybe i must reconsider..
    if i want the sun to be an egg and if i want a rugby ball to be like moon
    ok enough of poetry maybe forget the site and go out to get drunk ...

    thanks for trying to help

  13. #33
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    Thanks, gparis, you connected the dots for me. In my head i had the movie clips rooted to the stage, but of course that's not the case. Steber_j, i've created an example for you to pick apart, I believe this works like you want.
    Attached Files Attached Files

  14. #34
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    yes but my main movie is made in 1278x944 and it will crop
    no it won't. if your whole main movie is inside 'content' it will scale down to the available space.

    gparis

  15. #35
    ...dishing dimes on an .fla! pointguard's Avatar
    Join Date
    Dec 2001
    Location
    Cambridgeshire, England
    Posts
    1,017
    had you thought of using pop-ups?
    just have the pop-up window open in a window with the same name, so you don't get 60+ pop-up's open up...

  16. #36
    Member
    Join Date
    Jan 2008
    Posts
    57
    thankz guys i was planning to upload it next weekend but i will give it some time more
    bitsk308 i will test the scale methods in the fla (good that you have html also)
    just after the pizza!
    send me the pm if you want ,i'd like to show you the site

  17. #37
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    As for your 4 different levels and 2 'containers', my method will require you to load your stuff into the 'bg' clip. This clip will then resize based on the window parameters, as you want, and the internal clips will inversely resize to balance. You should use the MovieClipLoader class to load into clips within the bg clip. I understand this may require you to learn some new methods about loading external parts, but it'll be worth it, and you'll be able to that stuff more effieciently next time.

  18. #38
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    Sorry, don't know what pm is.

  19. #39
    Member
    Join Date
    Jan 2008
    Posts
    57
    Quote Originally Posted by pointguard
    had you thought of using pop-ups?
    just have the pop-up window open in a window with the same name, so you don't get 60+ pop-up's open up...
    yes the site is in a fullscreen non resizable popup
    the problem is at the wide monitors cause the content stretch to width =left and right (with my method: exact fit)
    so an egg appears as a ball
    if it wasn't the wide monitors i would leave it as it is ..

  20. #40
    Member
    Join Date
    Jan 2008
    Posts
    57
    Quote Originally Posted by bitsk308
    Sorry, don't know what pm is.
    hehe pm=private message
    i wanted to show you the site but i cannot post it here cause it's temporarily uploaded at a friend's host ..and i have some space for testing at ../../
    so if you want pm your email

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