Apache flex 动作脚本问题 package com.rubenswieringa.interactiveemindmap{ 导入flash.display.DisplayObject; 导入flash.filters.BlurFilter; 导入flash.text.TextField; 导入flash.text.textfield自动调整大小; 导入mx.flash.UIMovieClip; 公共类NodeRendererBase扩展了UIMovieClip{ 私有变量透明:布尔值=false; 私有变量_text:String=“”; 私有静态const NUM_depth:uint=5; 公共函数noderenderbase():void{ this.cacheAsBitmap=true; //设置所有文本字段的设置: 变量i:int; var textField:textField; 对于(i=1;i

Apache flex 动作脚本问题 package com.rubenswieringa.interactiveemindmap{ 导入flash.display.DisplayObject; 导入flash.filters.BlurFilter; 导入flash.text.TextField; 导入flash.text.textfield自动调整大小; 导入mx.flash.UIMovieClip; 公共类NodeRendererBase扩展了UIMovieClip{ 私有变量透明:布尔值=false; 私有变量_text:String=“”; 私有静态const NUM_depth:uint=5; 公共函数noderenderbase():void{ this.cacheAsBitmap=true; //设置所有文本字段的设置: 变量i:int; var textField:textField; 对于(i=1;i,apache-flex,actionscript-3,variables,Apache Flex,Actionscript 3,Variables,我认为问题在于: package com.rubenswieringa.interactivemindmap { import flash.display.DisplayObject; import flash.filters.BlurFilter; import flash.text.TextField; import flash.text.TextFieldAutoSize; import mx.flash.UIMovieClip; pu

我认为问题在于:

package com.rubenswieringa.interactivemindmap {

    import flash.display.DisplayObject;
    import flash.filters.BlurFilter;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;

    import mx.flash.UIMovieClip;

    public class NodeRendererBase extends UIMovieClip {

        private var _transparent:Boolean = false;
        private var _text:String = "";

        private static const NUM_DEPTHS:uint = 5;

        public function NodeRendererBase ():void {
            this.cacheAsBitmap = true;
            // set settings for all TextFields:
            var i:int;
            var textField:TextField;
            for (i=1; i<=NodeRendererBase.NUM_DEPTHS; i++){
                textField = this.getChildByName("textField"+i) as TextField;
                textField.autoSize = TextFieldAutoSize.CENTER;
            }
        }

        public function setSkinByID (id:String):Boolean {
            this.gotoAndStop(id);
            if (this.currentLabel != id){
                return false;
            }
            this.applyText();
            return true;
        }

        public function setSkinByDepth (depth:int):Boolean {
            return this.setSkinByID("depth"+depth);
        }

        public function get text ():String {
            return this._text
        }
        public function set text (value:String):void {
            if (this._text == value){
                return;
            }
            this._text = value;
            this.applyText();
        }

        /**
         * 
         */
        private function applyText ():void {
            var i:int;
            // this method is not needed if the item-renderer is not displaying a certain depth:
            if (this.currentLabel.slice(0, 5) != "depth"){
                return;
            }
            // textField (TextField):
            var textField:TextField;
            for (i=1; i<=NodeRendererBase.NUM_DEPTHS; i++){
                textField = this.getChildByName("textField"+i) as TextField;
                if (i.toString() == this.currentLabel.slice("depth".length)){
                    textField.text = this._text;
                }else{
                    textField.text = "";
                }
            }
            // background (MovieClip):
            var background:DisplayObject;
            //for (i=1; i<=NodeRendererBase.NUM_DEPTHS; i++){
            for (i=1; i<=NodeRendererBase.NUM_DEPTHS; i++){
                background = this.getChildByName("background_mc"+i);
                if (i.toString() == this.currentLabel.slice("depth".length)){
                    textField = this.getChildByName("textField"+i) as TextField;
                    background.height = textField.height + (textField.y - background.y) * 2;
                }else{
                    background.visible = false;
                }
            }
        }

        public function setColor (index:int):void {
            var background:DisplayObject = this.getChildByName("background_mc"+this.currentLabel.slice("depth".length));
            background['gotoAndStop'](index);
        }

        public function get transparent ():Boolean {
            return this._transparent;
        }
        public function set transparent (value:Boolean):void {
            if (this._transparent == value){
                return;
            }
            this._transparent = value;
            // set visuals:
            var newFilters:Array = (value) ? [new BlurFilter(3, 3)] : [];
            this.filters = newFilters;
        }

    }

}

(i=1;i)你说的“失败”是什么意思?您看到的是什么行为?生成的swf有背景,这就是它的全部!小于5的值会产生以下结果:0:黑气泡,1:白气泡,2:第一个气泡是正常的其余部分有奇怪的渲染3:4:5:同样地升级,但如果超过5,则一切都是正常的blank@sam,对不起,但是你的链接与答案有什么关系?你是什么想说什么?我想知道查看其余文件是否会有所帮助。我终于找到了问题所在。随附的flashcomponents.swc文件仅包含五个层。这是限制因素。如果我想支持5个以上不同颜色的节点,我需要添加自定义层!感谢查看信息技术
for (i=1; i<=NodeRendererBase.NUM_DEPTHS; i++){
    textField = this.getChildByName("textField"+i) as TextField;
    textField.autoSize = TextFieldAutoSize.CENTER;
}