本文介绍了覆盖 flex 中的公共函数 initialize() 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我应该为 .mx_internal 放什么

i want to know what i should put befor .mx_internal

override public function initialize() : void
    {
        var target:DialogButtons;
        var watcherSetupUtilClass:Object;
        .mx_internal::setDocumentDescriptor(_documentDescriptor_);
        var bindings:* = _DialogButtons_bindingsSetup();
        var watchers:Array;
        target;
        if (_watcherSetupUtil == null)
        {
            watcherSetupUtilClass = getDefinitionByName("_components_DialogButtonsWatcherSetupUtil");
            var obj1:* = watcherSetupUtilClass;
            obj1.watcherSetupUtilClass["init"](null);
        }
        _watcherSetupUtil.setup(this, function (param1:String)
        {
            return target[param1];
        }// end function
        , bindings, watchers);
        var i:uint;
        while (i < bindings.length)
        {

            Binding(bindings[i]).execute();
            i = (i + 1);
        }
        mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
        mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
        super.initialize();
        return;
    }// end function

推荐答案

您不必每次访问 mx_internal 命名空间时都引用它.您只需将其导入类即可.使用这样的语句:

You don't have to reference the mx_internal namespace every time you access it. You can just import it into the class. Use statements like this:

import mx.core.mx_internal;
use namespace mx_internal;

然后像这样重写你的代码:

Then re-write your code like this:

override public function initialize() : void
    {
        var target:DialogButtons;
        var watcherSetupUtilClass:Object;
// line commented to snow the mx_internal less code
//        .mx_internal::setDocumentDescriptor(_documentDescriptor_);
        setDocumentDescriptor(_documentDescriptor_);
        var bindings:* = _DialogButtons_bindingsSetup();
        var watchers:Array;
        target;
        if (_watcherSetupUtil == null)
        {
            watcherSetupUtilClass = getDefinitionByName("_components_DialogButtonsWatcherSetupUtil");
            var obj1:* = watcherSetupUtilClass;
            obj1.watcherSetupUtilClass["init"](null);
        }
        _watcherSetupUtil.setup(this, function (param1:String)
        {
            return target[param1];
        }// end function
        , bindings, watchers);
        var i:uint;
        while (i < bindings.length)
        {

            Binding(bindings[i]).execute();
            i = (i + 1);
        }
// lines commented to snow the mx_internal less code
//        mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
 //       mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
        _bindings = _bindings.concat(bindings);
        _watchers = _watchers.concat(watchers);
        super.initialize();
        return;
    }// end function

这篇关于覆盖 flex 中的公共函数 initialize() 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 13:39