如何将html放入flash文件?

时间:2012-02-27 16:54:17

标签: html flash actionscript-3 flash-cs4

我正在制作一个网站,它的内容是一个html文件,所以如何打开我的flash文件中的html文件,以便闪存的导航栏保持

位置动作(我用来对齐几乎所有的动作)

stage.scaleMode=StageScaleMode.NO_SCALE;

stage.align=StageAlign.TOP_LEFT;

stage.addEventListener(Event.RESIZE, onStageResize);
addEventListener(Event.ENTER_FRAME, onFrame);

function onStageResize(evt:Event):void {

if(fullProjectPanelUp==true){

    fullProjectPanel.x = stage.stageWidth/2 - fullProjectPanel.width/2;
    fullProjectPanel.y = stage.stageHeight/2 - fullProjectPanel.height/2;

}

navContainer.y = stage.stageHeight-77;
navContainer.scaleX = stage.stageWidth/1225;
mainContainer.x = stage.stageWidth/2 - mainContainer.width/2;
mainContainer.y = stage.stageHeight/2 - mainContainer.height/2;

}

function onFrame(evt:Event):void {

if(fullProjectPanelUp==true){

    fullProjectPanel.x = stage.stageWidth/2 - fullProjectPanel.width/2;
    fullProjectPanel.y = stage.stageHeight/2 - fullProjectPanel.height/2;

}

navContainer.y = stage.stageHeight-77;
navContainer.scaleX = stage.stageWidth/1225;
mainContainer.x = stage.stageWidth/2 - mainContainer.width/2;
mainContainer.y = stage.stageHeight/2 - mainContainer.height/2;

}

和我的导航操作(我以前用于导航栏的操作)

import com.greensock.TweenLite;

var buttonArray:Array = new Array( );
var currentButton:Object = new Object;
var selectedSection:Number = 0;

var fullProjectPanelUp:Boolean=false;
var firstSectionUp:Boolean=true;
var secondSectionUp:Boolean=false;
var thirdSectionUp:Boolean=false;
var fourthSectionUp:Boolean=false;

var navContainer:Sprite=new Sprite  ;
addChild(navContainer);

var navArray:Array=["الرئيسية","المحتوى","المراجع","التواصل", "خريطة الموقع"];

for (var i:Number=0; i<5; i++) {

        var navItem:NavItem = new NavItem;
    navItem.x = navItem.width*i;
    navItem.nav_name.text = navArray[i];
    buttonArray.push(navItem);
    navItem.addListeners();
    navContainer.addChild(navItem);

    navItem.name = String(i);

    navItem.addEventListener(MouseEvent.CLICK, onNavClick);
}

function onNavClick(evt:MouseEvent):void {

    if(fullProjectPanelUp == true){

        removeChild(fullProjectPanel);
        fullProjectPanelUp = false;

    }

    selectedSection = Number(evt.currentTarget.name);

    currentButton.y = 0;
    currentButton.addListeners();
    currentButton.addEventListener(MouseEvent.CLICK, onNavClick);

    currentButton = evt.currentTarget;
    currentButton.removeListeners();
    currentButton.removeEventListener(MouseEvent.CLICK, onNavClick);

    animateOut();

}

function removeAllChildren():void {

    var k:uint=mainContainer.numChildren;

    while (k --) {
        mainContainer.removeChildAt(k);
    }
}

function animateOut():void {

    TweenLite.to(mainContainer, 0.6, { x:stage.stageWidth, alpha:0,         onComplete:animateIn});

}

function animateIn():void {

    removeAllChildren();
    mainContainer.gotoAndStop(selectedSection+1);

    TweenLite.to(mainContainer, 0.4, {alpha:1});

}

initialNavigation();

function initialNavigation():void {

    buttonArray[0].y = -10;
    currentButton = buttonArray[0];
    currentButton.removeListeners();
    currentButton.removeEventListener(MouseEvent.CLICK, onNavClick);
}

var navSide:NavSide = new NavSide;
navSide.x = navContainer.width;
navSide.width = stage.stageWidth - navContainer.width;
navSide.alpha = 0.7;
navContainer.addChild(navSide);

navContainer.y = stage.stageHeight-67;

如果你需要文件

"the files"

2 个答案:

答案 0 :(得分:1)

唯一可用的解决方案是在html页面中添加一个绝对容器。使用ExternalInterface.call,您可以将AS3中的坐标发送到javascript并设置html容器的位置。

请注意,您的swf的wmode必须设置为opaque或transparent,以允许在flash顶部显示html内容。

答案 1 :(得分:0)

如果您正在开发使用adobe AIR的移动应用程序,这确实可以完成并且非常简单。 只需使用StageWebView:http://www.adobe.com/devnet/air/quick_start_as/quickstarts/qs_using_stage_web_view.html