
紧急,求救,,谁帮忙看下flex这段代码有什么错吗?运行不出来
<mx:Script>////[CDATA[//importmx.events.ItemClickEvent;//importmx.collections.ArrayCo...
<mx:Script>
//
// [CDATA[
// import mx.events.ItemClickEvent;
// import mx.collections.ArrayCollection;
// import mx.controls.Alert;
//
// [Bindable]
// public var dataStr:List=new ArrayList();
//
//
// public function checkuser(event:MouseEvent):void{
// Alert.show("123----")
// var vstr=str.text;
//
// if(vstr="" ){
// Alert.show("请输入有效字符串","提示");
// }
// var arr:Array=new Array();
// arr = vstr.split(',');
//
// dataStr.add(arr)
// var str1:String = arr[0].toString();
// var str2:String = arr[1].toString();
// Alert.show('alert2原来字符串:' + vstr + '\n截取后的字符串为:\n第一部分:' + str1 + '\n第二部分:' + str2);
//
// }
//
// ]]
</mx:Script>
<mx:Form>
<mx:Text text="字符串截取" fontWeight="bold" fontSize="14" textAlign="center" width="233" color="#1B78C6"/>
<mx:FormItem label="输入字符串" fontSize="12" fontWeight="bold" horizontalAlign="left">
<mx:TextInput id="str"/>
</mx:FormItem>
<mx:HBox width="232" height="35" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="go" label="截取" fontSize="12" fontWeight="normal" click="spiltstr(event)" textAlign="center" height="30" width="60"/>
</mx:HBox>
</mx:Form>
<!-- <mx:DataGrid dataProvider="{dataStr}" width="400" id="s"
fontSize="12" borderStyle="inset" fontWeight="bold" textAlign="center" alternatingItemColors="[#F1B6B6, #F2EB37]" height="210" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="var"/>
<mx:ComboBox
</mx:columns>
</mx:DataGrid>
-->
</mx:Application> 展开
//
// [CDATA[
// import mx.events.ItemClickEvent;
// import mx.collections.ArrayCollection;
// import mx.controls.Alert;
//
// [Bindable]
// public var dataStr:List=new ArrayList();
//
//
// public function checkuser(event:MouseEvent):void{
// Alert.show("123----")
// var vstr=str.text;
//
// if(vstr="" ){
// Alert.show("请输入有效字符串","提示");
// }
// var arr:Array=new Array();
// arr = vstr.split(',');
//
// dataStr.add(arr)
// var str1:String = arr[0].toString();
// var str2:String = arr[1].toString();
// Alert.show('alert2原来字符串:' + vstr + '\n截取后的字符串为:\n第一部分:' + str1 + '\n第二部分:' + str2);
//
// }
//
// ]]
</mx:Script>
<mx:Form>
<mx:Text text="字符串截取" fontWeight="bold" fontSize="14" textAlign="center" width="233" color="#1B78C6"/>
<mx:FormItem label="输入字符串" fontSize="12" fontWeight="bold" horizontalAlign="left">
<mx:TextInput id="str"/>
</mx:FormItem>
<mx:HBox width="232" height="35" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="go" label="截取" fontSize="12" fontWeight="normal" click="spiltstr(event)" textAlign="center" height="30" width="60"/>
</mx:HBox>
</mx:Form>
<!-- <mx:DataGrid dataProvider="{dataStr}" width="400" id="s"
fontSize="12" borderStyle="inset" fontWeight="bold" textAlign="center" alternatingItemColors="[#F1B6B6, #F2EB37]" height="210" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="var"/>
<mx:ComboBox
</mx:columns>
</mx:DataGrid>
-->
</mx:Application> 展开
2个回答
展开全部
click="spiltstr(event)" 方法未定义
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml
" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.List;
[Bindable]
public var dataStr:ArrayCollection=new ArrayCollection();
protected function go_clickHandler(event:MouseEvent):void
{
var vstr:String="";
vstr = str.text;
if(vstr=="" ){
Alert.show("请输入有效字符串","提示");
}
var arr:Array=new Array();
arr = vstr.split(',');
dataStr.addItem(arr);
var str1:String = arr[0].toString();
var str2:String = "";
if(arr.length >1){
str2= arr[1].toString()
}
Alert.show('alert2原来字符串:' + vstr + '\n截取后的字符串为:\n第一部分:' + str1 + '\n第二部分:' + str2);
}
]]>
</mx:Script>
<mx:Form>
<mx:Text text="字符串截取" fontWeight="bold" fontSize="14" textAlign="center" width="233" color="#1B78C6"/>
<mx:FormItem label="输入字符串" fontSize="12" fontWeight="bold" horizontalAlign="left">
<mx:TextInput id="str"/>
</mx:FormItem>
<mx:HBox width="232" height="35" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="go" label="截取" fontSize="12" fontWeight="normal" click="go_clickHandler(event)" textAlign="center" height="30" width="60"/>
</mx:HBox>
</mx:Form>
</mx:Application>
希望对你有帮助
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询