設為首頁:
on (release) {
getURL("java script(document.links[0].style.behavior='url(#default#homepage)');void document.links[0].setHomePage('http://www.flashempire.com/');", "_self", "POST");
}
加入收藏夾:
on (release) {
getURL("java script:void window.external.AddFavorite('網址,'網頁名稱');", "_self", "POST");
}
二,用fscommand的方法,有點複雜
1,先在flash的按鈕上添加代碼:
首頁:
on (release) {
fscommand("setHomePage", "網址");
}
收藏夾:
on (release) {
fscommand("addFavorite", "網址|網頁名稱");
}
然後在發佈設置中選擇flash with fscommand,發佈成html
2,修改html:
找到
// Handle all the the FSCommand messages in a Flash movie
function sethomepage_DoFSCommand(command, args) {
}
這一段,修改成:
// Handle all the the FSCommand messages in a Flash movie
function sethomepage_DoFSCommand(command, args) {
var sethomepageObj = InternetExplorer ? sethomepage : document.sethomepage;
if (command == "setHomePage") {
document.links[0].style.behavior = "url(#default#homepage)";
document.links[0].setHomePage(args);
} else if (command == "addFavorite") {
args = args.split("|");
window.external.AddFavorite(args[0], args[1]);
}
}
2、在File>Publish setting...中設定
HTML中的Tempalte : Flash with FSCommand
發佈
3、編輯發佈生成的html檔,找到以下一段:
code:--------------------------------------------------------------------------------<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function Movie1_DoFSCommand(command, args) {
var Movie1Obj = InternetExplorer ? Movie1 : document.Movie1;
//
// Place your code here...
//
}
...
--------------------------------------------------------------------------------
改為:
code:--------------------------------------------------------------------------------<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function Movie1_DoFSCommand(command, args) {
var Movie1Obj = InternetExplorer ? Movie1 : document.Movie1;
// Place your code here...
if (command == "open_window")
{
arg_array=args.split(";");
windows.open(arg_array[0],arg_array[1],arg_array[2]);
}
}
...
--------------------------------------------------------------------------------
OK!
如果是插入現有的html頁,可以先發佈,再copy相應的代碼到html檔。
23。問: 如何用action控制倒放?
答: 做一個mc放在合適的地方,裏面有兩影格
第一影格:
If (GetProperty ("/a",_currentframe)<=1)
Begin Tell Target ("/a")
Go to and Stop (GetProperty ("/a",_totalframes))
End Tell Target
Else
Begin Tell Target ("/a")
Go to and Stop (GetProperty ("/a",_currentframe)-1)
End Tell Target
End If
第二影格:
Go to and Play (1)
If (GetProperty ("/a",_currentframe)<=1)
Begin Tell Target ("/a")
Go to and Stop (GetProperty ("/a",_totalframes))
End Tell Target
Else
Begin Tell Target ("/a")
Go to and Stop (GetProperty ("/a",_currentframe)-1)
End Tell Target
End If
第二影格:
Go to and Play (1)
這一段肯定放在一個mc 裏,
假設這個mc為/b
在/a需要停止的影格裡設置
Begin Tell Target ("/b")
stop
End Tell Target
stop
就可以了
24。問:如何在AS中創建類的繼承?
答:創建一個MC的繼承類
myClass=function(){
……
}
myClass.prototype = new MovieClip();
(turbine)
77。問:如何在FLASH中重複播放部分影格N次然後再跳轉?
答:Set Variable: "i" = 1
Set Variable: "time" = 5
comment:time表示重複次數。
comment:以下是想重複的內容影格名為repeat
…………
If (i<=time)
Set Variable: "i" = i+1
Go to and Play (repeat)
End If
便可。