The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: How to overcome this problem when resizing the SWF file according to browser size?

  1. #1

    How to overcome this problem when resizing the SWF file according to browser size?

    Hi,

    I am resizing the flash (.swf) file accroding to the browser window to fit on any screen resolution. But the problem I am facing now is related to animations which cross the STAGE area. Say, I have an aeroplane_mc which starts animating from x:-200 to x:1200 (my stage width=1000 & height=600), the my flash (swf) file gets shrink.


    Because of this problem I cannot make any animation which moves out of stage. Please help me in resolving this problem.


    The code to resize the window is as below:

    Code:
    var myStage:Stage=this.stage;
    myStage.scaleMode=StageScaleMode.NO_SCALE;
    myStage.align=StageAlign.TOP_LEFT;
    
    function initialDisplay(event:Event):void{
    var swfWidth:int=myStage.stageWidth;
    var swfHeight:int=myStage.stageHeight;
    
    Background.width=swfWidth;
    Background.height=swfHeight;
     
    }
    
    addEventListener(Event.ENTER_FRAME,initialDisplay);
    Thanks in advance for any help.
    Attached Files Attached Files
    Last edited by learner_7n; May 2nd, 2012 at 04:22 PM.

  2. #2
    your easiest way to deal with this is to rivisit any place where you are putting a hard coded value and send it through a helper function something that would duplicate it by ration aka:

    function getPoint(0.2,1){
    returns current numbers based on current screen size.
    ...
    }

    then just travel through your code and update it to fetch first the updated numbers so when users change there resolution your animation will update as well. if you want to go fancy add an event to capture when the screen resolution changes and then update the values again in the middle of animations (using a que put all animations into array and then run through them stop them and update them where there new destination is going to be using the same function).


    P.s the getPoints takes in ratios and returns real values. so if you want it to go out of the screen you can use a ratio of 1.3 or more and if you need it to be accurate you can add more parameters such as offsets

    getPoint(1,1,offsetX,offsetY);

    adding it to the outcome or add the offset after the function returns the values.

    let me know if u got any Q's if no one answers u just buz me on twitt to come back my twit is @02geek
    Last edited by everythingFLA; May 3rd, 2012 at 06:36 PM.
    02geek.com online school that focuses on building development skills from the basics of actionscript, javascript to html5. Learning fast isn't always better Learning better is better - avoid the "learn in 2 days" agendas and subscribe to my school.

  3. #3
    Quote Originally Posted by everythingFLA View Post
    your easiest way to deal with this is to rivisit any place where you are putting a hard coded value and send it through a helper function something that would duplicate it by ration aka:

    function getPoint(0.2,1){
    returns current numbers based on current screen size.
    ...
    }

    then just travel through your code and update it to fetch first the updated numbers so when users change there resolution your animation will update as well. if you want to go fancy add an event to capture when the screen resolution changes and then update the values again in the middle of animations (using a que put all animations into array and then run through them stop them and update them where there new destination is going to be using the same function).


    P.s the getPoints takes in ratios and returns real values. so if you want it to go out of the screen you can use a ratio of 1.3 or more and if you need it to be accurate you can add more parameters such as offsets

    getPoint(1,1,offsetX,offsetY);

    adding it to the outcome or add the offset after the function returns the values.

    let me know if u got any Q's if no one answers u just buz me on twitt to come back my twit is @02geek
    Thanks a lot for your kind reply. Being a learner, It is difficult for me to overcome this problem. Could you please help me out to modify the attached FLA (for coding) so that I can understand and use it in my other sample projects.

    Regards,
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012