AS2没有名称为

时间:2018-08-12 11:52:35

标签: actionscript-2

我在Flash CS6中发布了.fla文件,并给了我错误“行181没有名为'visibleRect'的属性”。和“第309行没有名称为'visibleRect'的属性。”

请有人帮我!我对AS2没有任何经验,我只是尝试编辑csgo背景的.swf文件。

class Lib.ResizeManager
{
var AdditionalScaling, ApplyAdditionalScaling, AuthoredWidth, AuthoredHeight;
function ResizeManager()
{
    for (var _loc2 = 0; _loc2 <= Lib.ResizeManager.SCALE_USING_HORIZONTAL; ++_loc2)
    {
        ScalingFactors.push(1);
    } // end of for
    for (var _loc2 = 0; _loc2 <= Lib.ResizeManager.REFERENCE_CENTER_Y; ++_loc2)
    {
        ReferencePositions.push(0);
    } // end of for
} // End of the function
function getSafezone(name)
{
    var _loc2 = 8.500000E-001;
    if (_global.GameInterface)
    {
        _loc2 = _global.GameInterface.GetConvarNumber(name);
    } // end if
    if (_loc2 == null || _loc2 == undefined)
    {
        _loc2 = 8.500000E-001;
    } // end if
    if (_loc2 <= 1.000000E-001)
    {
        _loc2 = 1.000000E-001;
    }
    else if (_loc2 > 1)
    {
        _loc2 = 1;
    } // end else if
    return (_loc2);
} // End of the function
function UpdateReferencePositions()
{
    var _loc3 = this.getSafezone("safezonex");
    var _loc4 = this.getSafezone("safezoney");
    if (_global.GameInterface)
    {
        AdditionalScaling = _global.GameInterface.GetConvarNumber("hud_scaling");
    } // end if
    POSITION_SAFE_LEFT = (1 - _loc3) / 2;
    POSITION_SAFE_RIGHT = Lib.ResizeManager.POSITION_SAFE_LEFT + _loc3;
    POSITION_SAFE_TOP = (1 - _loc4) / 2;
    POSITION_SAFE_BOTTOM = Lib.ResizeManager.POSITION_SAFE_TOP + _loc4;
    ReferencePositions[Lib.ResizeManager.REFERENCE_LEFT] = ScreenX;
    ReferencePositions[Lib.ResizeManager.REFERENCE_RIGHT] = ScreenX + ScreenWidth;
    ReferencePositions[Lib.ResizeManager.REFERENCE_TOP] = ScreenY;
    ReferencePositions[Lib.ResizeManager.REFERENCE_BOTTOM] = ScreenY + ScreenHeight;
    ReferencePositions[Lib.ResizeManager.REFERENCE_CENTER_X] = Math.floor((ReferencePositions[Lib.ResizeManager.REFERENCE_LEFT] + ReferencePositions[Lib.ResizeManager.REFERENCE_RIGHT]) / 2);
    ReferencePositions[Lib.ResizeManager.REFERENCE_CENTER_Y] = Math.floor((ReferencePositions[Lib.ResizeManager.REFERENCE_TOP] + ReferencePositions[Lib.ResizeManager.REFERENCE_BOTTOM]) / 2);
    ReferencePositions[Lib.ResizeManager.REFERENCE_SAFE_LEFT] = ScreenX + Math.ceil(Lib.ResizeManager.POSITION_SAFE_LEFT * ScreenWidth);
    ReferencePositions[Lib.ResizeManager.REFERENCE_SAFE_TOP] = ScreenY + Math.ceil(Lib.ResizeManager.POSITION_SAFE_TOP * ScreenHeight);
    ReferencePositions[Lib.ResizeManager.REFERENCE_SAFE_RIGHT] = ScreenX + Math.floor(Lib.ResizeManager.POSITION_SAFE_RIGHT * ScreenWidth);
    ReferencePositions[Lib.ResizeManager.REFERENCE_SAFE_BOTTOM] = ScreenY + Math.floor(Lib.ResizeManager.POSITION_SAFE_BOTTOM * ScreenHeight);
} // End of the function
function GetScalingValue(index, disableAdditionalScaling)
{
    if (disableAdditionalScaling == null || disableAdditionalScaling == undefined)
    {
        disableAdditionalScaling = DisableAdditionalScaling;
    } // end if
    if (ApplyAdditionalScaling && !disableAdditionalScaling)
    {
        return (ScalingFactors[index] * AdditionalScaling);
    }
    else
    {
        return (ScalingFactors[index]);
    } // end else if
} // End of the function
function SetXYScaling(obj, scalingX, disableAdditionalScalingX, scalingY, disableAdditionalScalingY)
{
    if (obj.originalWidth == null)
    {
        obj.originalWidth = obj._width;
        obj.originalHeight = obj._height;
    } // end if
    var _loc3 = this.GetScalingValue(scalingX, disableAdditionalScalingX);
    var _loc4 = this.GetScalingValue(scalingY, disableAdditionalScalingY);
    obj.scaledWidth = Math.ceil(obj.originalWidth * _loc3);
    obj.scaledHeight = Math.ceil(obj.originalHeight * _loc4);
    return ({x: _loc3, y: _loc4});
} // End of the function
function SetScaling(obj, scaling)
{
    var _loc4 = scaling;
    if (obj.originalWidth == null)
    {
        obj.originalWidth = obj._width;
        obj.originalHeight = obj._height;
    } // end if
    scaling = this.GetScalingValue(scaling);
    obj.scaledWidth = Math.ceil(obj.originalWidth * scaling);
    obj.scaledHeight = Math.ceil(obj.originalHeight * scaling);
    if (_loc4 == Lib.ResizeManager.SCALE_BIGGEST)
    {
        if (obj.scaledWidth > ScreenWidth + 1 || obj.scaledHeight > ScreenHeight + 1)
        {
            if (ScreenHeight > 0 && ScreenWidth / ScreenHeight >= 3)
            {
                scaling = this.SetScaling(obj, Lib.ResizeManager.SCALE_SMALLEST);
            } // end if
        } // end if
    } // end if
    return (scaling);
} // End of the function
function SetMatrixXY(obj, x, y, scaleX, scaleY)
{
    var _loc2 = new flash.geom.Matrix(scaleX, 0, 0, scaleY, x, y);
    obj.transform.matrix = _loc2;
    obj._width = Math.ceil(obj._width);
    obj._height = Math.ceil(obj._height);
} // End of the function
function SetMatrix(obj, x, y, scale)
{
    var _loc2 = new flash.geom.Matrix(scale, 0, 0, scale, x, y);
    obj.transform.matrix = _loc2;
    obj._width = Math.ceil(obj._width);
    obj._height = Math.ceil(obj._height);
} // End of the function
function GetPctPosition(position, anchor, rectDim, stageDim)
{
    return (Math.floor(stageDim * position - rectDim * anchor));
} // End of the function
function ResetPosition(obj, scaling, positiony, positionx, anchory, anchorx)
{
    var _loc3 = this.SetScaling(obj, scaling);
    var _loc5 = this.GetPctPosition(positionx, anchorx, obj.scaledWidth, ScreenWidth);
    var _loc4 = this.GetPctPosition(positiony, anchory, obj.scaledHeight, ScreenHeight);
    this.SetMatrix(obj, ScreenX + _loc5, ScreenY + _loc4, _loc3);
} // End of the function
function GetPixelPosition(screenReference, screenOffset, elementAlignment, elementSize)
{
    return (Math.floor(ReferencePositions[screenReference] + screenOffset - elementSize * elementAlignment));
} // End of the function
function ResetPositionByPixel(obj, scaling, xScreenReference, xScreenOffset, xElementAlign, yScreenReference, yScreenOffset, yElementAlign)
{
    var _loc3 = this.SetScaling(obj, scaling);
    var _loc5 = this.GetPixelPosition(xScreenReference, xScreenOffset, xElementAlign, obj.scaledWidth);
    var _loc4 = this.GetPixelPosition(yScreenReference, yScreenOffset, yElementAlign, obj.scaledHeight);
    this.SetMatrix(obj, _loc5, _loc4, _loc3);
} // End of the function
function ResetXYPositionByPixel(obj, scalingX, includeAdditionalScalingX, scalingY, includeAdditionalScalingY, xScreenReference, xScreenOffset, xElementAlign, yScreenReference, yScreenOffset, yElementAlign)
{
    var _loc2 = this.SetXYScaling(obj, scalingX, includeAdditionalScalingX, scalingY, includeAdditionalScalingY);
    var _loc5 = this.GetPixelPosition(xScreenReference, xScreenOffset, xElementAlign, obj.scaledWidth);
    var _loc4 = this.GetPixelPosition(yScreenReference, yScreenOffset, yElementAlign, obj.scaledHeight);
    this.SetMatrixXY(obj, _loc5, _loc4, _loc2.x, _loc2.y);
} // End of the function
function ResetPositionByPercentage(obj, scaling, xScreenReference, xScreenOffset, xElementAlign, yScreenReference, yScreenOffset, yElementAlign)
{
    var _loc3 = this.SetScaling(obj, scaling);
    var _loc5 = this.GetPixelPosition(xScreenReference, xScreenOffset * ScreenWidth, xElementAlign, obj.scaledWidth);
    var _loc4 = this.GetPixelPosition(yScreenReference, yScreenOffset * ScreenHeight, yElementAlign, obj.scaledHeight);
    this.SetMatrix(obj, _loc5, _loc4, _loc3);
} // End of the function
function updateSafeZone()
{
    this.UpdateReferencePositions();
    var _loc4 = Listeners.length;
    var _loc3;
    for (var _loc2 = 0; _loc2 < _loc4; _loc2 = _loc2 + 1)
    {
        _loc3 = Listeners[_loc2];
        if (_loc3.onResize != undefined)
        {
            Listeners[_loc2].onResize(this);
            DisableAdditionalScaling = false;
        } // end if
    } // end of for
} // End of the function
function onResize()
{
    this.doResize(false);
} // End of the function
function doResize(force)
{
    var _loc2 = Stage.visibleRect;
    if (_loc2 == null)
    {
        ScreenWidth = Stage.width;
        ScreenHeight = Stage.height;
        ScreenX = 0;
        ScreenY = 0;
    }
    else
    {
        var _loc3 = false;
        var _loc6 = Math.floor(_loc2.left);
        var _loc4 = Math.floor(_loc2.top);
        var _loc9 = Math.ceil(_loc2.width);
        var _loc8 = Math.ceil(_loc2.height);
        if (ScreenWidth != _loc9 || force)
        {
            ScreenWidth = _loc9;
            ScreenHeight = _loc8;
            ScreenX = _loc6;
            ScreenY = _loc4;
            _loc3 = true;
        }
        else if (ScreenHeight != _loc8)
        {
            ScreenHeight = _loc8;
            ScreenX = _loc6;
            ScreenY = _loc4;
            _loc3 = true;
        }
        else if (ScreenX != _loc6)
        {
            ScreenX = _loc6;
            ScreenY = _loc4;
            _loc3 = true;
        }
        else if (ScreenY != _loc4)
        {
            ScreenY = _loc4;
            _loc3 = true;
        } // end else if
        if (!_loc3)
        {
            return;
        } // end if
    } // end else if
    var _loc5 = ScreenWidth / AuthoredWidth;
    var _loc7 = ScreenHeight / AuthoredHeight;
    if (_loc5 >= _loc7)
    {
        ScalingFactors[Lib.ResizeManager.SCALE_BIGGEST] = _loc5;
        ScalingFactors[Lib.ResizeManager.SCALE_SMALLEST] = _loc7;
    }
    else
    {
        ScalingFactors[Lib.ResizeManager.SCALE_BIGGEST] = _loc7;
        ScalingFactors[Lib.ResizeManager.SCALE_SMALLEST] = _loc5;
    } // end else if
    ScalingFactors[Lib.ResizeManager.SCALE_USING_VERTICAL] = _loc7;
    ScalingFactors[Lib.ResizeManager.SCALE_USING_HORIZONTAL] = _loc5;
    this.updateSafeZone();
} // End of the function
function changeUIDevice()
{
    var _loc4 = Listeners.length;
    var _loc3;
    for (var _loc2 = 0; _loc2 < _loc4; _loc2 = _loc2 + 1)
    {
        _loc3 = Listeners[_loc2];
        if (_loc3.changeUIDevice != undefined)
        {
            Listeners[_loc2].changeUIDevice();
        } // end if
    } // end of for
} // End of the function
function GetListenerIndex(listener, l)
{
    var _loc2 = 0;
    if (l == -1)
    {
        l = Listeners.length - 1;
    } // end if
    while (_loc2 <= l)
    {
        if (Listeners[_loc2] == listener)
        {
            return (_loc2);
            continue;
        } // end if
        ++_loc2;
    } // end while
    return (-1);
} // End of the function
function AddListener(listener)
{
    if (this.GetListenerIndex(listener, -1) == -1)
    {
        Listeners.push(listener);
        listener.onResize(this);
        DisableAdditionalScaling = false;
    } // end if
} // End of the function
function RemoveListener(listener)
{
    var _loc3 = Listeners.length - 1;
    var _loc2 = this.GetListenerIndex(listener, _loc3);
    if (_loc2 == -1)
    {
        return;
    } // end if
    if (_loc2 == _loc3)
    {
        Listeners.length = _loc3;
    }
    else if (_loc2 == 0)
    {
        Listeners.shift();
    }
    else
    {
        Listeners = Listeners.slice(0, _loc2).concat(Listeners.slice(_loc2 + 1, _loc3 + 1));
    } // end else if
} // End of the function
static function Init()
{
    if (_global.resizeManager == null)
    {
        var _loc2 = new Lib.ResizeManager();
        var _loc3 = Stage.originalRect;
        if (_loc3 != null)
        {
            _loc2.AuthoredWidth = _loc3.width;
            _loc2.AuthoredHeight = _loc3.height;
        }
        else
        {
            _loc2.AuthoredWidth = Stage.width;
            _loc2.AuthoredHeight = Stage.height;
        } // end else if
        _loc2.onResize();
        Stage.addListener(_loc2);
        _global.resizeManager = _loc2;
    } // end if
} // End of the function
function Remove()
{
    Listeners.length = 0;
    Stage.removeListener(this);
    _global.resizeManager = null;
} // End of the function
static var ALIGN_NONE = 0;
static var ALIGN_LEFT = 0;
static var ALIGN_RIGHT = 1;
static var ALIGN_TOP = 0;
static var ALIGN_BOTTOM = 1;
static var ALIGN_CENTER = 5.000000E-001;
static var POSITION_LEFT = 0;
static var POSITION_SAFE_LEFT = 7.500000E-002;
static var POSITION_RIGHT = 1;
static var POSITION_SAFE_RIGHT = 9.250000E-001;
static var POSITION_TOP = 0;
static var POSITION_SAFE_TOP = 7.500000E-002;
static var POSITION_BOTTOM = 1;
static var POSITION_SAFE_BOTTOM = 9.250000E-001;
static var POSITION_CENTER = 5.000000E-001;
static var REFERENCE_LEFT = 0;
static var REFERENCE_TOP = 1;
static var REFERENCE_SAFE_LEFT = 2;
static var REFERENCE_SAFE_TOP = 3;
static var REFERENCE_RIGHT = 4;
static var REFERENCE_BOTTOM = 5;
static var REFERENCE_SAFE_RIGHT = 6;
static var REFERENCE_SAFE_BOTTOM = 7;
static var REFERENCE_CENTER_X = 8;
static var REFERENCE_CENTER_Y = 9;
static var SCALE_NONE = 0;
static var SCALE_BIGGEST = 1;
static var SCALE_SMALLEST = 2;
static var SCALE_USING_VERTICAL = 3;
static var SCALE_USING_HORIZONTAL = 4;
static var PC_BORDER_SIZE = 10;
var ScalingFactors = new Array();
var ReferencePositions = new Array();
var ScreenWidth = -1;
var ScreenHeight = -1;
var ScreenX = -1;
var ScreenY = -1;
var DisableAdditionalScaling = false;
var Listeners = new Array();
} // End of Class

0 个答案:

没有答案