`
wangangie28
  • 浏览: 47387 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

Passing request data with flashVars properties

 
阅读更多

  If you are using the generated wrapper from Flash Builder, then you add flashVars variables by creating an object called flashvars, setting properties on that object, and then passing that object to the swfobject.embedSWF() method of SWFObject 2. The following example sets the firstname and lastname properties of the flashvars object, and then passes that object to the embedSWF() method:  var swfVersionStr = "10.0.0"; var xiSwfUrlStr = "playerProductInstall.swf"; var flashvars = {}; flashvars.firstname = "Nick"; flashvars.lastname = "Danger"; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; var attributes = {}; attributes.id = "TestProject"; attributes.name = "TestProject"; attributes.align = "middle"; swfobject.embedSWF( "FlashVarTest.swf", "flashContent", "100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); swfobject.createCSS("#flashContent", "display:block;text-align:left;"); 
  If your wrapper uses the  and  tags, you can pass variables to your applications by using the flashVars properties in the  and  tags in your wrapper. You do this by adding ampersand-separated sets of name-value pairs to these properties. The following example sets the values of the firstname and lastname in the flashVars properties inside the  and  tags in a simple wrapper:   code/wrapper/SimplestFlashVarTestWrapper.html  body { margin: 0px; overflow:hidden }    width='100%' height='100%' cellspacing='0' cellpadding='0'> Simplest FlashVarTest Wrapper width='100%'>   width='100%' flashVars='firstname=Nick&lastname=Danger'/>    
  The value of the flashVars properties do not have to be static. If you use JSP to return the wrapper, for example, you can use any JSP expression for the value of the flashVars properties that can be evaluated to a String. The following example uses the values stored in the HttpServletRequest object (in this case, you can use form or query string parameters):      DynamicFlashVarTestWrapper.jsp   var swfVersionStr = "0"; var xiSwfUrlStr = ""; var flashvars = {}; flashvars.firstname = ""; flashvars.lastname = ""; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; var attributes = {}; attributes.id = "FlashVarTest"; attributes.name = "FlashVarTest"; attributes.align = "middle"; swfobject.embedSWF( "FlashVarTest.swf", "flashContent", "100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);       
  You can also PHP expressions to pass query string parameters in a wrapper, as the following example shows:       var swfVersionStr = ""; var xiSwfUrlStr = ""; var flashvars = {}; flashvars.fName = "" flashvars.lName = "" var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; var attributes = {}; attributes.id = "FlashVarTest"; attributes.name = "FlashVarTest"; attributes.align = "middle"; swfobject.embedSWF( "FlashVarTest.swf", "flashContent", "100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); swfobject.createCSS("#flashContent", "display:block;text-align:left;");      
  For more information about the HTML wrapper, see Creating a wrapper. If your user requests the SWF file directly in the browser, without a wrapper, you can access variables on the query string without providing additional code in the wrapper (because there is no wrapper). The following URL passes the name Nick and the hometown San Francisco to the application: About flashVars properties encoding
  The values of the flashVars properties must be URL encoded. The format of the string is a set of name-value pairs separated by an ampersand (&). You can escape special and nonprintable characters with a percent symbol (%) followed by a two-digit hexadecimal value. You can represent a single blank space by using the plus sign (+). The encoding for flashVars properties is the same as the page. Internet Explorer provides UTF-16-compliant strings on the Windows platform. Netscape sends a UTF-8-encoded string to Flash Player. Most browsers support a flashVars string or query string up to 64 KB (65535 bytes) in length. They can include any number of name-value pairs. You can append the values of properties to the application's SWF file path in the wrapper. The swfUrlStr property identifies the location of the application's SWF file. It is the first argument in theswfobject.embedSWF() method call. The following example appends query string parameters to the swfUrlStr properties in the custom wrapper:     wrapper/SwfObjectWithFlashVars.html   var swfVersionStr = "0"; var xiSwfUrlStr = ""; var flashvars = {}; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; var attributes = {}; attributes.id = "FlashVarTest"; attributes.name = "FlashVarTest"; attributes.align = "middle"; swfobject.embedSWF( "FlashVarTest.swf?firstname=Nick&lastname=Danger", "flashContent", "100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);      
  Variables you define in this manner are accessible in the same way as flashVars properties. For more information, see Accessing the flashVars properties. To access the values of the flashVars properties, you use the FlexGlobals object's topLevelApplication.parameters property. This property points to a dynamic object that stores the parameters as name-value pairs. You can access variables on the parameters object by specifying parameters.variable_name. In your application, you typically assign the values of the run-time properties to local variables. You assign the values of these properties after the Application's creationComplete event is dispatched. Otherwise, the run-time properties might not be available when you try to assign their values to local variables. The following example defines the myName and myHometown variables and binds them to the text of Label controls in the initVars() method:   flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="initVars()">              
  When a user requests this application with the myName and myHometown parameters defined as flashVars properties or as query string parameters, Flex displays their values in the Label controls. To view all the flashVars properties, you can iterate over the FlexGlobals.topLevelApplication.parameters properties, as the following example shows:   flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="init()">      width="300" height="200"/> Adobe Link : http://help.adobe.com/en_US/flex/using/WS2db454920 e96a9e51e63e3d11c0bf626ae-7feb.html
分享到:
评论

相关推荐

    Clustering by Passing Messages Between Data Points

    AP算法提出原文。Clustering data by identifying a subset of ... Affinity propagation found clusters with much lower error than other methods, and it did so in less than one-hundredth the amount of time.

    Exam Ref 70-761 Querying Data with Transact-SQL

    Exam Ref 70-761 Querying Data with Transact-SQL by Itzik Ben-Gan English | 4 Apr. 2017 | ASIN: B06Y21QGGQ | 352 Pages | AZW3 | 23.79 MB Prepare for Microsoft Exam 70-761–and help demonstrate your ...

    Passing parameters with data reports. I have set two paramet

    Passing parameters with data reports. I have set two parameters and passed them during run time.Open with VB6.

    Passing Binary Data in COM在COM中传递二进制数据

    在COM(Component Object Model)中,传递二进制数据是一个常见的需求,特别是在处理图像、音频、文件等非结构化数据时。... 首先,让我们来看看`BufferVariant.h`这个文件名,它暗示了一个使用了`VARIANT`类型的缓冲...

    Designing Data Tier Components and Passing Data Through Tiers

    ### 设计数据层组件与跨层传递数据 在设计分布式应用程序时,如何高效地访问、表示及管理业务数据是至关重要的。本篇文章旨在提供一系列指导原则,帮助开发人员选择最合适的暴露、持久化以及跨应用层传递数据的方法...

    react-passing-data

    这个项目是用引导的。 您将在下面找到有关如何执行常见任务的一些信息。 您可以在找到本指南的最新版本。目录自动格式化代码更改页面<title>... 使用 AJAX 请求获取数据与 API 后端集成节点Ruby on Rails 在开发...

    AP聚类_Clustering by Passing Messages Between Data Points1

    【标题】:AP聚类(Affinity Propagation)_通过数据点间传递消息进行聚类 【描述】:AP聚类方法是由Brendan J. Frey和Delbert Dueck提出的一种新的数据聚类技术,它着重于寻找数据集中的代表性实例(exemplars),...

    Message Passing Interface (MPI)

    Message Passing Interface (MPI),Message Passing Interface (MPI)

    reactnd-passing-data2

    该项目是通过。 您将在下面找到一些有关如何执行常见任务的信息。 您可以在找到本指南的最新版本。目录更新到新版本Create React App分为两个包: create-react-app是用于创建新项目的全局命令行实用程序。...

    LDPC message passing 译码算法

    用于LDPC的译码程序,使用message passing 算法,可以选择迭代次数, 调整信噪比,用LLR计算

    Manning.Spring.in.Action.4th.Edition.2014.11.epub

    3.4.1. Working with request and session scope 3.4.2. Declaring scoped proxies in XML 3.5. Runtime value injection 3.5.1. Injecting external values 3.5.2. Wiring with the Spring Expression Language 3.6...

    BizObj.rar_Passing Through

    描述提到的是"Microsoft Designing Data Tier Components and Passing Data Through Tiers",这显然是一个讨论如何在多层架构中设计数据层组件并有效地在各层之间传递数据的教程或指南。 在IT领域,特别是在企业级...

    Machine learning for graph-based representations

    In this paper, we develop an alternative network reduction approach to characterizing transport in DFNs, by combining graph theoretical and ma- ...consistent with those of the original network.

    udacity-react-passing-data2

    该项目是通过引导的。 您将在下面找到一些有关如何执行常见任务的信息。 您可以在找到本指南的最新版本。 目录 自动格式化代码 更改页面<title> 安装依赖项 导入组件 代码分割 添加样式表 ...met

    Flattern.zip

    * Axios and Ajax Request (Passing request for fetch and crud operation) * How to Use Moment js on Laravel (Used for formating date time) * How to Use sweetalert2 (Used for flash message) * How to ...

    Interest-aware Message-Passing GCN for Recommendat.md

    Interest-aware Message-Passing GCN for Recommendat.md

Global site tag (gtag.js) - Google Analytics