FLASH AS3 Web site Resolution Adaptive

Source: Internet
Author: User

In the production of Flash all the time, there are some must be mastered. The stage amplification element does not deform, it is necessary.

Just add one sentence to the first frame: Stage.scalemode=stagescalemode.no_scale can not deform. This attribute of the stage can be more explained in the Help. At this point, the stage is always centered. This is a hassle for us to localize the components, because the 0 coordinates of the x and Y axes are not in the upper-left corner of the display, but in the upper-left corner of the stage. And the stage is centered, so when the x, Y axis of the component is 0 o'clock, some positions are also vacated in the upper left corner.

We must align the upper left corner of the stage: Stage.align=stagealign.top_left Similarly, if you want to align to the top right corner or to the lower right corner, you can view its help for more information. Finally insert the flash into the HTML, remember the width is set to 100%. There are also HTML margins to be set to 0. Remember!

AS3 has a listening event for the stage change: Event.resize, which triggers the event when the stage size changes. Don't understand, please leave a message and communicate with each other.


Example code: Make the MC of A, B, C, D four rectangles remain in the top left of the browser, upper right, lower left, lower right

No deformation processing
Stage.scalemode=stagescalemode.no_scale
Align top left corner
Stage.align=stagealign.top_left
Customize a function to control the position of four MC
function MyFunction () {
Position of a
A.x=0
A.y=0
Location of B
B.x=stage.stagewidth-b.width
B.y=0
Location of C
C.x=0
C.y=stage.stageheight-c.height
Location of D
D.x=stage.stagewidth-d.width
D.y=stage.stageheight-d.height
}
Listening for changes to the stage
Stage.addeventlistener (event.resize,test);

function test (e:event): void {
When the stage changes, reset the position of the MC
MyFunction ();
}
Set up MC position
MyFunction ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.