开发者

How do you create a full page backgroud image using Adobe flash

Create a full page background image slideshow like http://beyondfay开发者_如何学编程te.com/ and http://hmxmedia.com/ using Flash? I'm new to flash and I want to know hoe to create these full screen image slideshows, that start on page load and scale proportionally just like the above two websites, using Flash CS5 AS3.


Something like:

HTML:

<!doctype html>
<html>
    <head>
        <title>Example</title>

        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="your_styles.css">
    </head>
    <body>
        <object>
            <embed src="your_flash.swf" />
        </object>
    </body>
</html>

CSS:

html,
body
{
    height: 100%;
    padding: 0px;
}

body{ overflow: hidden; }

object,
embed
{
    width: 100%;
    height: 100%;
}

AS3:

package
{
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.display.StageAlign;

    public class Document extends Sprite
    {
        /**
         * Constructor
         */
        public function Document()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
        }
    }
}


You need to the flash width and height to 100% in the HTML tags, and listen to the Event.RESIZE handler to manually scale and move around the content as you want (use stage.stageWidth / stage.stageHeight to get the new size).

You also need to set the scaleMode to something useful, eg: stage.scaleMode = StageScaleMode.NO_SCALE;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜