dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: stage resizing

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Nottingham, England
    Posts
    263

    stage resizing

    Hi,

    This is going to be simple but i cant figure out why the resize isnt working - the scroller moves to the far right of the stage and the buttons disappear completely... anyone see the isse?

    PHP Code:
    package {

        
    import flash.events.*;
        
    import flash.display.*;

        public class 
    scrollmenu extends MovieClip {

            private var 
    sample1:MovieClip;
            private var 
    sample2:MovieClip;
            private var 
    sample3:MovieClip;
            private var 
    sample4:MovieClip;
            private var 
    leftBtn:MovieClip;
            private var 
    rightBtn:MovieClip;
            private var 
    masker:MovieClip;
            private var 
    scroller:MovieClip;

            public function 
    scrollmenu() {

                
    init();
            }
            private function 
    init():void {

                
    stage.scaleMode StageScaleMode.NO_SCALE;
                
    stage.align StageAlign.TOP_LEFT;
                
                
    leftBtn = new MovieClip;
                
    leftBtn.graphics.beginFill(0x4b0000);
                
    leftBtn.graphics.drawRoundRect(stage.stageWidth/-90stage.stageHeight-20040,40,5,5);
                
    leftBtn.graphics.endFill();
                
    leftBtn.buttonMode=true;
                
    addChild(leftBtn);
                
                
    rightBtn = new MovieClip;
                
    rightBtn.graphics.beginFill(0x4b0000);
                
    rightBtn.graphics.drawRoundRect(stage.stageWidth/+50stage.stageHeight-20040,40,5,5);
                
    rightBtn.graphics.endFill();
                
    rightBtn.buttonMode=true;
                
    addChild(rightBtn);
                
                
    masker = new MovieClip;
                
    masker.graphics.lineStyle(0.250x000000);
                
    masker.graphics.beginFill(0x000000);
                
    masker.graphics.drawRoundRect(stage.stageWidth/2-105,50,210,110,5,5);
                
    masker.graphics.endFill();
                
    addChild(masker);
                
                
    scroller = new MovieClip;
                
    scroller.graphics.beginFill(0x4b00000.9);
                
    scroller.graphics.drawRoundRect(stage.stageWidth/2-1055062011055);
                
    scroller.graphics.endFill();
                
    addChild(scroller);
                
    scroller.mask masker;
                            
                
    sample1 = new MovieClip;
                
    sample1.graphics.beginFill(0x000000);
                
    sample1.graphics.drawRoundRect(0020010055);
                
    sample1.graphics.endFill();
                
    scroller.addChild(sample1)
                
                
    stage.addEventListener(Event.RESIZE,resizeHandler);
                
            }
            function 
    resizeHandler(evt:Event):void {

                
    leftBtn.stage.stageWidth /-90;
                
    leftBtn.stage.stageHeight -200;
                
                
    rightBtn.stage.stageWidth /+50;
                
    rightBtn.stage.stageHeight -200;
                
                
    scroller.stage.stageWidth /-105;
                
    scroller.50;
                
                
    masker.stage.stageWidth /-105;
                
    masker.50;
                
                
            }
            
        }


  2. #2
    Senior Member
    Join Date
    Jan 2007
    Location
    Nottingham, England
    Posts
    263
    new day and another look - i think this has genuinely got me stumped...

    considering how annoying it is, it's making me laugh. i've added a trace to the script and am really lost now...

    PHP Code:
    package {

        
    import flash.events.*;
        
    import flash.display.*;

        public class 
    scrollmenu extends MovieClip {

            private var 
    sample1:MovieClip;
            private var 
    sample2:MovieClip;
            private var 
    sample3:MovieClip;
            private var 
    sample4:MovieClip;
            private var 
    leftBtn:MovieClip;
            private var 
    rightBtn:MovieClip;
            private var 
    masker:MovieClip;
            private var 
    scroller:MovieClip;

            public function 
    scrollmenu() {

                
    init();
            }
            private function 
    init():void {

                
    stage.scaleMode StageScaleMode.NO_SCALE;
                
    stage.align StageAlign.TOP_LEFT;

                
    leftBtn = new MovieClip;
                
    leftBtn.graphics.beginFill(0xff0000);
                
    leftBtn.graphics.drawRoundRect(stage.stageWidth/-90stage.stageHeight-20040,40,5,5);
                
    leftBtn.graphics.endFill();
                
    leftBtn.buttonMode=true;
                
    addChild(leftBtn);

                
    rightBtn = new MovieClip;
                
    rightBtn.graphics.beginFill(0x4b0000);
                
    rightBtn.graphics.drawRoundRect(stage.stageWidth/+50stage.stageHeight-20040,40,5,5);
                
    rightBtn.graphics.endFill();
                
    rightBtn.buttonMode=true;
                
    addChild(rightBtn);

                
    masker = new MovieClip;
                
    masker.graphics.lineStyle(0.250x000000);
                
    masker.graphics.beginFill(0x000000);
                
    masker.graphics.drawRoundRect(stage.stageWidth/2-105,50,210,110,5,5);
                
    masker.graphics.endFill();
                
    addChild(masker);

                
    scroller = new MovieClip;
                
    scroller.graphics.beginFill(0x4b00000.9);
                
    scroller.graphics.drawRoundRect(stage.stageWidth/2-1055062011055);
                
    scroller.graphics.endFill();
                
    addChild(scroller);
                
    scroller.mask masker;

                
    sample1 = new MovieClip;
                
    sample1.graphics.beginFill(0x000000);
                
    sample1.graphics.drawRoundRect(0020010055);
                
    sample1.graphics.endFill();
                
    scroller.addChild(sample1);
                
    stage.addEventListener(Event.RESIZE,resizeHandler);
                
    stage.addEventListener(MouseEvent.CLICKonClick);

            }
            function 
    resizeHandler(evt:Event):void {

                
    leftBtn.stage.stageWidth /-90;
                
    leftBtn.stage.stageHeight -200;

                
    rightBtn.stage.stageWidth /+50;
                
    rightBtn.stage.stageHeight -200;

                
    scroller.stage.stageWidth /-105;
                
    scroller.50;

                
    masker.stage.stageWidth /-105;
                
    masker.50;


            }
            function 
    onClick(evt:Event):void {

                
    trace(leftBtn.x);
                
    trace(leftBtn.y);
            }
        }


  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Nottingham, England
    Posts
    263
    i sort of found the problem.

    this has work hundreds of time on other swfs i've made and the only different was the one's that worked were created using sprites/movieclips from the library.

    on this one that doesnt work the movieclips are created in the scripting, so why does it not work when you create the movieclip in the scripting but does when you add the movieclip from the library?

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