百度空间 | 百度首页 
 
查看文章
 
FLASH AS2通过JS 获得地址栏信息(URL)
2009-08-21 16:35

AS:
import flash.external.*
mm.onPress = function ()
{
    tt.text = flash.external.ExternalInterface.call("getURL", "aa");
};
js:
function getURL(){
var url=document.URL
return url
}
发布时 HTML那里请选择带FSCOMMAND的
下面是例子:
---------------------------------------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>myFlash</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#ffffff">
<!--url’s used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="JavaScript">
<!--
function setURL(id){
var hs=document.location.hash
if(hs==null || hs=="" ||hs=="#"){
document.location.hash=id
  
}else{
document.location.hash=id
}
return document.url
}
//end function
function delURL(){
document.location.hash=""
}
//end function
function readURL(){
var all_value=new Array()
var all_data=new String(document.location.hash)
all_data=all_data.slice(1)
return all_data
document.write(all_data)
}
//end function
function getURL(){
var url=document.URL
return url
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write(’<script language=\"VBScript\"\>\n’);
document.write(’On Error Resume Next\n’);
document.write(’Sub myFlash_FSCommand(ByVal command, ByVal args)\n’);
document.write(’ Call myFlash_DoFSCommand(command, args)\n’);
document.write(’End Sub\n’);
document.write(’</script\>\n’);
}
//-->
</script>
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent( ’codebase’,’http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0’,’name’,’myFlash’,’width’,’550’,’height’,’400’,’align’,’middle’,’id’,’myFlash’,’src’,’geturl’,’quality’,’high’,’bgcolor’,’#ffffff’,’allowscriptaccess’,’sameDomain’,’allowfullscreen’,’false’,’pluginspage’,’http://www.macromedia.com/go/getflashplayer’,’movie’,’geturl?’+readURL() ); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" name="myFlash" width="550" height="400" align="middle" id="myFlash">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="geturl.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="geturl.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="myFlash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ourbrander/archive/2008/10/18/3097392.aspx


类别:分享 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu