Reputation: 9
i'm making a website and the content of it is a html file so how can i open the html file inside my flash file so the navigation bar of the flash stays
position actions (the actions i used to align almost evrything)
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;
}
and my navigation actions (the actions i used to for the navigation bar)
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;
and if u need the files
Upvotes: 1
Views: 1188
Reputation:
If you are developing for a mobile app with adobe AIR this can indeed be done and is very easy. Just use the StageWebView: http://www.adobe.com/devnet/air/quick_start_as/quickstarts/qs_using_stage_web_view.html
Upvotes: 0
Reputation: 5978
The only solution available would be to add an absolute container in your html page. Using ExternalInterface.call
you may send coordinates from the AS3 to the javascript and set the position of the html container.
Note that your swf's wmode must be set to opaque or transparent to allow html content on top of flash.
Upvotes: 1