Working with the Stage : stage « Development « Flash / Flex / ActionScript

Flash / Flex / ActionScript
1. Animation
2. Array
3. Class
4. Data Type
5. Development
6. Function
7. Graphics
8. Language
9. Network
10. Regular Expressions
11. Statement
12. String
13. TextField
14. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Flash / Flex / ActionScript » Development » stage 
Working with the Stage
 

package{
  import flash.display.Sprite;
  import flash.display.Stage;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.display.DisplayObjectContainer;
  import flash.events.Event;

  public class Main extends Sprite
  {
         public function Main()
         {
                this.graphics.beginFill(0xff00001);
                this.graphics.drawRect(00, stage.stageWidth/2, stage.stageHeight/2);
                this.graphics.endFill();
                //set what part of the browser the stage will set itself in
                this.stage.align = StageAlign.TOP_LEFT;
                //set how the stage scales itself
                this.stage.scaleMode = StageScaleMode.NO_SCALE;
                //add an event listener for the stages resized event
                stage.addEventListener(Event.RESIZE, stageResized);

          }

         private function stageResized(event:Event):void
         {
                trace(stage.stageHeight+"  "+stage.stageWidth);

                this.graphics.clear();
                this.graphics.beginFill(0xff00001);
                this.graphics.drawRect(00, stage.stageWidth/2, stage.stageWidth/2);
                this.graphics.endFill();
        }
  }
}

        
Related examples in the same category
1. Setting the Frame Rate
2. Traversing Objects in a Display Hierarchy
3. Recursive display list tree traversal
4. Distinguishing Events Targeted at an Object from Events Targeted at That Object's Descendants
5. responds to mouse clicks that occur over any object on the display list, but not over a vacant area of the Stage instance
6. A stretchy layout
7. Simple Scribble
8. Local Global Sample
ww__w___.___ja___v__a2__s_.___co_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.