ボタンを「ヒット」状態のままにして、新しいページを呼び出して新しいボタンを非アクティブにしたらアクティブにするページのボタンを無効にするダイナミックフラッシュナビゲーションメニューを作成しようとしています。
これは、ムービー クリップと古い学校の gotoAndPlay/Stop のわずかな手で実行できることはわかっていますが、これを actionscript で実行したいと考えているため、他のプロジェクトではクリーンでスケーラブルです。
私は自分の試みをzipファイルに投稿しました
http://www.webstudioproductions.com/navtry.zip
助けを借りて再生してください
//編集された追加
このswfをphpインクルード関数から呼び出しています。現在の状態で swf を試したところ、非アクティブ化されたホームページとオフになっているはずのホーム以外のすべてのボタンで、ユーザーがロールオーバーしてアクティブになりました。
stop();
//get page string
var pageURL:String=ExternalInterface.call('window.location.href.toString');
//set up website pages
var homeURL:String=('http://www.webstudioproductions.com/index.html');
var servicesURL:String=('http://www.webstudioproductions.com/services.html');
var portfolioURL:String=('http://www.webstudioproductions.com/portfolio.html');
var associatesURL:String=('http://www.webstudioproductions.com/associates.html');
var contactusURL:String=('http://www.webstudioproductions.com/contactus.html');
// show rollover state of pageURL
function pageLoad():void {
if(pageURL==homeURL) {
nav.nav_home.gotoAndPlay("hit");
}else if(pageURL==servicesURL){
nav.nav_service.gotoAndPlay("hit");
}else if(pageURL==portfolioURL){
nav.nav_portfolio.gotoAndPlay("hit");
}else if(pageURL==associatesURL){
nav.nav_associates.gotoAndPlay("hit");
}else if(pageURL==contactusURL){
nav.nav_contactus.gotoAndPlay("hit");
}else{
gotoAndStop(1);
}
}
pageLoad();
/* main nav */
nav.nav_home.buttonMode = true;
nav.nav_home.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
nav.nav_home.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
nav.nav_home.addEventListener(MouseEvent.CLICK, nav_homeClick);
nav.nav_service.buttonMode = true;
nav.nav_service.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
nav.nav_service.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
nav.nav_service.addEventListener(MouseEvent.CLICK, nav_serviceClick);
nav.nav_portfolio.buttonMode = true;
nav.nav_portfolio.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
nav.nav_portfolio.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
nav.nav_portfolio.addEventListener(MouseEvent.CLICK, nav_portfolioClick);
nav.nav_associates.buttonMode = true;
nav.nav_associates.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
nav.nav_associates.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
nav.nav_associates.addEventListener(MouseEvent.CLICK, nav_associatesClick);
nav.nav_contactus.buttonMode = true;
nav.nav_contactus.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
nav.nav_contactus.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
nav.nav_contactus.addEventListener(MouseEvent.CLICK, nav_contactusClick);
function onButtonOver(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("over");
}
function onButtonOut(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("out");
}
/* main nav */
function nav_homeClick(e:MouseEvent):void
{
var nav_homeURL:URLRequest = new URLRequest ("http://www.webstudioproductions.com/index.html");
navigateToURL(nav_homeURL, "_parent");
}
function nav_serviceClick(e:MouseEvent):void
{
var nav_serviceURL:URLRequest = new URLRequest ("http://www.webstudioproductions.com/services.html");
navigateToURL(nav_serviceURL, "_parent");
}
function nav_portfolioClick(e:MouseEvent):void
{
var nav_portfolioURL:URLRequest = new URLRequest ("http://www.webstudioproductions.com/portfolio.html");
navigateToURL(nav_portfolioURL, "_parent");
}
function nav_associatesClick(e:MouseEvent):void
{
var nav_associatesURL:URLRequest = new URLRequest ("http://www.webstudioproductions.com/associates.html");
navigateToURL(nav_associatesURL, "_parent");
}
function nav_contactusClick(e:MouseEvent):void
{
var nav_contactusURL:URLRequest = new URLRequest ("http://www.webstudioproductions.com/contactus.html");
navigateToURL(nav_contactusURL, "_parent");
}