- 浏览: 500515 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
michao:
大哥,还有aperture.exe吗? 发我一份,找不到呀,m ...
使用aperture框架让AS3与C++通信,执行本地代码 -
Aaron-Joe-William:
文件被删除了。下不了。
SQLite 数据库加密的一种解决方案 -
hanmiao:
樓主的文章不就是來自IBM Developers里的http: ...
mina 入门 -
howesen:
断包与粘包问题,需要处理下就好了
mina接收数据不全(2) -
sniciq:
git clone --recursive git://git ...
ESB学习笔记(Spring Integration实战)
鉴于adobe并没有提供FileReference对浏览的文件的完整路径的接口。
只能采用JS和fileinput控件来获取本地路径了。
mxml代码
<!--ReadLocalFile.mxml-->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
private
function
init():void
{
ExternalInterface.addCallback("OnFileChange" ,frSelectHandler);//注册JS回调
btnBrowser.addEventListener(MouseEvent.CLICK,mouseClickHandler);
}
private function mouseClickHandler(event:MouseEvent):void
{
ExternalInterface.call("Browser" );//调用JS中Browser函数
}
private function frSelectHandler(path:String):void
{
imgTest.source = path;
}
]]>
</mx:Script>
<mx:Button id="btnBrowser" x="10" y="10" label="Button" />
<mx:Image id="imgTest" x="10" y="50"/>
</mx:Application>
html端代码
<!-- ReadLocalFile.html -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="history/history.css" />
<title></title>
<script src="AC_OETags.js" language="javascript"></script>
<script src="history/history.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 28;
//关键代码
function Browser()
{
document.getElementById("fileInput").click();
}
function OnFileChange()
{
thisMovie("ReadLocalFile").OnFileChange(document.getElementById("fileInput").value);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
</script>
</head>
<body scroll="no">
<input type="file" id="fileInput" style="display:none" onchange="OnFileChange()" /><!--fileInput控件-->
<script language="JavaScript" type="text/javascript">
var hasProductInstall = DetectFlashVer(6, 0, 65);
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "ReadLocalFile",
"quality", "high",
"bgcolor", "#869ca7",
"name", "ReadLocalFile",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer "
);
} else if (hasRequestedVersion) {
AC_FL_RunContent(
"src", "ReadLocalFile",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "ReadLocalFile",
"quality", "high",
"bgcolor", "#869ca7",
"name", "ReadLocalFile",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer "
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="ReadLocalFile" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab ">
<param name="movie" value="ReadLocalFile.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="ReadLocalFile.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="ReadLocalFile" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer ">
</embed>
</object>
</noscript>
</body>
</html>
{
ExternalInterface.addCallback("OnFileChange" ,frSelectHandler);//注册JS回调
btnBrowser.addEventListener(MouseEvent.CLICK,mouseClickHandler);
}
private function mouseClickHandler(event:MouseEvent):void
{
ExternalInterface.call("Browser" );//调用JS中Browser函数
}
private function frSelectHandler(path:String):void
{
imgTest.source = path;
}
]]>
</mx:Script>
<mx:Button id="btnBrowser" x="10" y="10" label="Button" />
<mx:Image id="imgTest" x="10" y="50"/>
</mx:Application>
html端代码
<!-- ReadLocalFile.html -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="history/history.css" />
<title></title>
<script src="AC_OETags.js" language="javascript"></script>
<script src="history/history.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 28;
//关键代码
function Browser()
{
document.getElementById("fileInput").click();
}
function OnFileChange()
{
thisMovie("ReadLocalFile").OnFileChange(document.getElementById("fileInput").value);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
</script>
</head>
<body scroll="no">
<input type="file" id="fileInput" style="display:none" onchange="OnFileChange()" /><!--fileInput控件-->
<script language="JavaScript" type="text/javascript">
var hasProductInstall = DetectFlashVer(6, 0, 65);
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "ReadLocalFile",
"quality", "high",
"bgcolor", "#869ca7",
"name", "ReadLocalFile",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer "
);
} else if (hasRequestedVersion) {
AC_FL_RunContent(
"src", "ReadLocalFile",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "ReadLocalFile",
"quality", "high",
"bgcolor", "#869ca7",
"name", "ReadLocalFile",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer "
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="ReadLocalFile" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab ">
<param name="movie" value="ReadLocalFile.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="ReadLocalFile.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="ReadLocalFile" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer ">
</embed>
</object>
</noscript>
</body>
</html>
发表评论
-
十个Flex/Air疑难杂症及解决方案简略
2010-05-31 17:17 3300最近去一家台企面 ... -
Windows环境下配置+运行red5源码+AS3连接red5简单示例
2010-04-19 13:39 5148Windows环境下配置+运行red5源码+AS3连接red5 ... -
使用aperture框架让AS3与C++通信,执行本地代码
2010-04-08 16:48 3194我们都知道,AIR的效果是非常出色的,这也是大家喜欢她的原因, ... -
SQLITE入门至精通
2010-04-07 11:13 2964关键 ... -
教你解析FLEX JSON中的一个问题 关于键值 和键
2010-04-01 15:25 2269字符串:message = ' "param&quo ... -
air写文件保存在安装目录
2010-03-31 15:46 3179AIR中..保存文件我们般会像下面这样操作 var f ... -
弱弱的一个小问题,bitmapdata pngencoder base64 bytearray
2010-03-31 14:16 1119好久没写东东了,呵呵。随便写点点。关于bitmapdata如何 ... -
FLASH教程:SWF间的双向通信
2010-03-02 18:23 1319假设有一个主 SWf 名为 m ... -
如何把as文件生成swf格式文件
2010-03-02 18:22 5201一,从http://opensource.adobe.com/ ... -
Flex数据交互方法 :httpservice, webservice, RemoteObject, socket
2010-02-27 17:06 1882【转载】 文章分类:Flash编程 http://h ... -
理解Flash Player 9垃圾回收机制
2010-02-02 18:27 1038理解Flash Player 9垃圾回 ... -
BlazeDS入门教程-很详细-赞原创作者一个
2010-01-11 23:51 1679什么是BlazeDS呢?BlazeDS是一个基于服务器的Ja ... -
一些漂亮的Flex主题下载
2010-01-11 10:31 6117一些漂亮的Flex主题下载1Digg meWindows Cl ... -
通过Stratus 服务器在Flash Player中使用RTMFP 开发 点对点应用(一)
2010-01-08 17:43 5361作者:Jozsef Vass 译者:巴巴鲁 ... -
ActionScript 3.0著名开源库 大集合
2009-12-29 17:26 1993这篇文章开始于对Adrian ... -
Flex 读取XML配置文件总结
2009-11-19 11:45 1944在Flex中我 ... -
一个list定义组件,网上找了很久没有,自己做了一个。
2009-10-29 11:55 1197一个list定义组件,网上找了很久没有,自己做了一个。希望对大 ... -
如何使用Flex RemoteObject components 与JAVA交互
2009-10-08 18:04 52412008-12-25 | 22:53分类:前端开发 ... -
flex 在线录制视频语音
2009-09-12 17:45 3566<?xml version="1.0" ... -
flex 蒙板 遮罩
2009-09-11 17:09 3841方法一 <mx:Image source=&q ...
相关推荐
如何在flex中读取shapefile文件
flex开发的读取本地txt文件的代码,可选择txt文件,读取内容,无需js帮忙
flex读取excel文件,环境:flex4.6,flashplayer11。 内有自己写一个简单测试。 第一次上传资料,3个银子,多不多啊,呵呵
完美的Flex多语言支持解决方案
Flex读取xml文件 几种方法Flex读取xml文件 几种方法Flex读取xml文件 几种方法
通过flex actionscript读取pdf 文件,并且有放大缩小分页等功能
包含多版本的flex导入/导出excel文件的源码工程,flex与java项目独立,可以独立运行,导入/导出excel文件使用java poi及as3xls多种方式
Flex 文件上传的文件代码 交你一步一步的完成上传功能
简单的文件读写程序,适合新手学习。可对导入的文本文件进行修改再导出
flex读取xml乱码的解决方法
实现文件上传下载到数据中,有上传精度条显示,可以上传MP3,MP4,txt等各种文件,可以再线浏览txt,word,excel等文件。
和winodw系统的文件管理操作方式相像
Flex文件上传(某GIS系统,我负责的文件上传部分),有详细代码及注释。希望跟朋友们交流下。
flex 解析xml文件,利用httpservice读取xml文件,按要求过滤字符串,获取对应的值
flex 打开本地图片并进行显示 var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onLoadByted); loader.loadBytes(this.fileReference.data);
这是使用flex解析xml文件,并将xml文件的内容作为ComboBox下拉列表的数据提供源
Flex帮助文件 Flex帮助文件 Flex帮助文件 Flex帮助文件 Flex帮助文件
Flex+Java 文件上传
flex3 java 文件上传源码,flex端和java端是分开的,这样的层次更加清晰明了!
创 建过Java多语言本地化应用的朋友应该都很熟悉Java的本地...要本地化Flex2应用,我们需要将本地化资源文件编译为SWC库文件,然后在Flex应用中使用ActionScript或者MXML访问资源集(resource bundles )中的本地化值。