override public function initialize() error in flex

天涯浪子 提交于 2019-12-24 17:29:26

问题


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

回答1:


mx_internal should be without dot.




回答2:


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


来源:https://stackoverflow.com/questions/5916421/override-public-function-initialize-error-in-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!