flex通过url传参至as脚本中
(注:采用fb4 beta1开发,由于兼容问题,可以适当加以修改放到自己的环境中,测试的时候需要放到服务器上面,本人的测试url为
http://127.0.0.1/astest/asjs.html?msnum=13112345678)
mxml文件:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" creationComplete="application1_creationCompleteHandler(event)" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var tempParam:String;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
var param:String=ExternalInterface.call("test");
if(param!=""){
tempParam=param;
}
handlerParam();
}
private function handlerParam():void{
testText.text=tempParam;
}
]]>
</fx:Script>
<s:TextInput id="testText" x="23" y="34" width="198" height="31"/>
</s:Application>
index.template.html模板文件需要添加的js代码:
var tempparam="";
var localurl2 = location.href;
function getParameter(paraStr, url)
{
var result = "";
var str = "&" + url.split("?")[1];
var paraName = paraStr + "=";
if(str.indexOf("&"+paraName)!=-1)
{
if(str.substring(str.indexOf(paraName),str.length).indexOf("&"
相关文档:
Testing Flex applications with FlexMonkey 1.0
Without automation, testing the UI components of your Flex
application can be tedious and time consuming. Adobe includes an
automation framework in Flex to enable developers to create automated
tests that operate at the GUI level. FlexMonkey
1.0 i ......
需求:
开发flex的过程中遇到一个问题。flex的项目需要在客服端显示一个局域网类的一台服务器的文件目录结构,并且要能够点击访问。
预想:
flex在以前的版本里面没有file类,这个可以用java代码在后台进行处理,生成xml文件。前台的flex到相应目录下面读取数据即可。
困难:
flash被下载到客服端,有严格的安全 ......
这一次的Flex 实践将要实现以下功能:
1、自定义一个简单的 Flex 组件
2、创建一个Index. mxml 来调用该组件
1)用 as 调用组件
&nbs ......
方法一:
<?xml version="1.0"?>
<!-- events/MultipleEventHandlersInline.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
private function submitForm(e:Event):void {
// Handle event here.
......
<?
xml
version
=
"1.0"
?>
<!-- Simple example to demonstrate the Alert control. -->
<
mx:Application
xmlns:mx
=
"http://www.adobe.com/2006/mxml"
>
&n ......