返回列表 发帖

6-6代码无法成功运行

我运行一段代码可是有问题:
提示错误如下:
1046: 找不到类型,或者它不是编译时常数: TextInput。
Can not resolve a multiname reference unambiguously. TextInput (from C:\Users\Nathaniel\Documents\Flex Builder 3\Flex Learning\src\TextInput.mxml) and mx.controls:TextInput (from C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\framework.swc(mx/controls/TextInput)) are available.

Can not resolve a multiname reference unambiguously. TextInput (from C:\Users\Nathaniel\Documents\Flex Builder 3\Flex Learning\src\TextInput.mxml) and mx.controls:TextInput (from C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\framework.swc(mx/controls/TextInput)) are available.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
        creationComplete="InitApp()">
        <mx:Script>
                <![CDATA[
                        import mx.controls.TextInput;
                        
                        private function InitApp():void
                        {
                                // 循环10次
                                for(var i:int=1; i<=10; i++)
                                {
                                        // 把文本框增加到舞台中
                                        this.addChild(CreateTextInput(i.toString(), "文本框" + i.toString(), 50, i*30));
                                }
                        }
                        
                        private function CreateTextInput(_Id:String, _text:String, _X:Number, _Y:Number):TextInput                        {
                                // 创建文本框
                                var textInput:TextInput = new TextInput();
                                // 设置文本框的宽度
                                textInput.width = 100;
                                // 设置文本框的标识属性ID
                                textInput.id = _Id;
                                // 设置坐标
                                textInput.x = _X;
                                textInput.y = _Y;
                                // 设置文本框的值
                                textInput.text = _text;
                                
                                return textInput;
                        }
                ]]>
        </mx:Script>
</mx:Application>
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友

这段代码,我运行了以后是没有问题的,可以运行。
是不是你的SDK 版本有问题啊,换个SDK试试。

TOP

返回列表