flex + js or a file path

2009-08-10  来源:本站原创  分类:AJAX  人气:714 

Adobe did not provide the light of the FileReference browse the full path of the document interface.
JS and fileinput can only be used to obtain control of the local path.
mxml code
<! - 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); / / register JS callbacks btnBrowser.addEventListener (MouseEvent.CLICK, mouseClickHandler);
)

private function mouseClickHandler (event: MouseEvent): void
(
ExternalInterface.call ( "Browser"); / / call the JS in the Browser function)

private function frSelectHandler (path: String): void
(
imgTest.source = path;
)
]]>
</ mx: Script>
<mx:Button x="10" y="10" label="Button" />
<mx:Image x="10" y="50"/>
</ mx: Application>

html-side code
<! - 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;
/ / Key code
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" onchange="OnFileChange()" /> <! - fileInput control ->
<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"
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 + js or a file path 2009-08-10

    Adobe did not provide the light of the FileReference browse the full path of the document interface. JS and fileinput can only be used to obtain control of the local path. mxml code <! - ReadLocalFile. Mxml -> <? xml version = "1.0" enc

  • flex using filereference implementation file upload / download 2010-09-06

    The following is a. Net instance, (the same basic and java, the problems are the same!) We start from the flex client to see what way the client through the server to initiate the request. flex client to complete the file upload and download are achi

  • Download flex issues with the Chinese path summary 2011-05-12

    Download flex issues with the Chinese path to summarize: Make sure you download the files to be accessed through a browser, http://127.0.0.1:8989/1test/ Chinese documents. Txt, If you can open the content will be significant. Xls files but do not kno

  • js如何获取file控件的完整路径具体实现代码 2015-03-04

    需要隐藏input file然后获取它的值,但连jquery都无法获取它的值,下面与大家分享下使用js的具体获取方法,感兴趣的朋友可以参考下哈 今天做一个项目,需要隐藏input file然后获取它的值,但连jquery都无法获取它的值 <script type="text/javascript"> //FX获取文件路径方法 function readFileFirefox(fileBrowser) { try { netscape.security.PrivilegeMa

  • Chongqing, Java, Flex, JS programmers how much salary? 2010-03-29

    Chongqing, Java, Flex, JS programmers how much salary? Two years of experience drops?

  • Java to get the file path in several ways (change) 2010-03-07

    Java to get the file path in several ways With regard to the absolute path and relative path: Absolute path is your home page file or directory on your hard drive the real path, (URL and the physical path) example: C: xyz est.txt represents the absol

  • file path handling some perl modules 2010-07-14

    Originally posted address: http://yesho.blogbus.com/c1615293/index_3.html perl proverb: There is more than one way to do it. Means that any problem with the perl has several solutions. When dealing with file path before all write regular expressions,

  • Change the table space data file path 2010-07-22

    1. First, connect to the database sql plus 2. Four steps - change the table space data file path 1.alter tablespace tbs_sttu offline; Physical copy to the specified path to this very important] [ 2.alter tablespace tbs_sttu rename datafile 'c: \ orac

  • Java package for reading resources or JAR file path 2010-07-26

    Here are divided into two specific: The first: the resource file for the general suffix file The second: Resource file for picture files First] [NO1 Use this line of code can get class path of the root class String path = Thread.currentThread (). Get

  • mysql installation problem on the implementation of the file path 2010-08-19

    Modify the service executable file path Articles Category: JavaEye Problems that occur when installing mysql. In the mysqld-nt - install after installing the service. Net start mysql a "system error 2, the system can not find the file." Solution

  • Use anti-check file path file fd 2010-08-20

    Process each file has to maintain a link is / Proc / (pid) / fd / (fdid) Use readlink read the link you can point to the file path

  • Flex to read binary file 2010-08-25

    Flex to read binary file Flex can be used to read binary file class has four: ByteArray, FileStream, Socket, URLStream. They all realized IdataInput interfaces, which are located flash.utils, flash.filesystem, flash.net, flash.net package. Be noted t

  • JS achieve Html File Control assignment 2010-09-06

    Online search for a long time and no complete solution. These methods need to be added to the trusted sites or discharge unsigned ActiveX controls to Disable 1. Simulated keyboard input method: lack of places that do not support Chinese <input Type=&qu

  • tfs file path on the 2010-09-25

    When doing the project encountered a problem, get on the tfs file path is not always like it, there are repeated, but unfortunately the Internet search, The following programs worthy of this man, like a Transfer from: http://hi.baidu.com/liulin0712/b

  • Modify the file path displayed like Ubuntu 2010-10-13

    Ubuntu 10.04 button by default display the file path, not like windows, as well as for the convenience of direct access to copy the file path to a path! So you have to modify the display into windows! Open a terminal, type gconf-editor Turn into the

  • PHP get current file path, parent directory path 2010-11-02

    PHP get current file path, parent directory path Now take the file, directory, parent directory in test.php, the need to do to obtain the path, directories, etc., see the following: Obtain the path + file name (to get / var / www / project / test.php

  • Ubuntu LAMP configuration file path under the 2010-11-22

    Configuration file path 1> apache configuration file path / etc/apache2/apache2.conf 2> apache web character encoding configuration path / etc/apache2/conf.d/charset 3> php.ini path / etc/php5/apache2/php.ini 4> mysql configuration file path /

  • Ubuntu the configuration file path under the LAMP 2010-11-22

    Configuration file path 1> apache configuration file path / etc/apache2/apache2.conf 2> apache web character encoding configuration path / etc/apache2/conf.d/charset 3> php.ini path / etc/php5/apache2/php.ini 4> mysql configuration file path /

  • Everything rapid access to study records of the file path USN 2011-01-06

    <! - Find more nothing to do, the worse the memory, multiplication remember something, and record to back up -> Following the article on the USN's exploration, we can be a simple operation USN, but the same basic things are not done - we can not get

  • php file path operations 2011-05-10

    $ Url = 'http://'. $ _SERVER ['HTTP_HOST']. Substr ($ REQUEST_URI, 0, strrpos ($ REQUEST_URI ,'/')); echo $ url; echo "<p>"; / / Echo strrpos ($ REQUEST_URI ,'/'); / / Echo substr ($ REQUEST_URI, 0, strrpos ($ REQUEST_URI ,'/')); echo dirn