如何使用Adobe Flash创建整页背景图像

时间:2011-10-05 22:00:31

标签: javascript flash actionscript-3 actionscript flash-cs5

使用Flash制作整页背景图片幻灯片,如http://beyondfayte.com/http://hmxmedia.com/? 我是flash的新手,我想知道如何使用Flash CS5 AS3创建这些全屏图像幻灯片,从页面加载和比例开始,就像上面两个网站一样。

3 个答案:

答案 0 :(得分:3)

类似的东西:

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;
        }
    }
}

答案 1 :(得分:1)

您需要在HTML标记中将flash宽度和高度设置为100%,然后聆听Event.RESIZE处理程序以手动缩放内容并在内容中移动(使用stage.stageWidth / stage.stageHeight获取新的尺寸)。

您还需要将scaleMode设置为有用的内容,例如:stage.scaleMode = StageScaleMode.NO_SCALE;

答案 2 :(得分:0)

你应该查看这个链接,希望这对你有用:

http://www.fladev.com/featured/building-a-fullscreen-background-image-with-as3/