当我点击按钮时,我想在flash中隐藏一个按钮

当我点击按钮时,我想在flash中隐藏一个按钮,flash,actionscript,Flash,Actionscript,朋友们,我想做一个flash练习。当我点击对象时,它应该隐藏或消失 on (release) { { setProperty("button1",_visible,false); } } 该函数的使用方式如下: setProperty(target:Object, property:Object, expression:Object) : Void 因此,这里的目标可以是对象本身或其名称,并且由于您位于按钮的时间线内,因此不能像在代码中那样直接使用其名称 要使对象进入其时间线,您有多种方式,

朋友们,我想做一个flash练习。当我点击对象时,它应该隐藏或消失

on (release) {
{
setProperty("button1",_visible,false);
}
}
该函数的使用方式如下:

setProperty(target:Object, property:Object, expression:Object) : Void
因此,这里的
目标可以是对象本身或其名称,并且由于您位于按钮的时间线内,因此不能像在代码中那样直接使用其名称

要使对象进入其时间线,您有多种方式,因此对于您的情况,您可以:

// In my case, the button1 object is inside the root timeline

on (release) {

    // you can use some traces to more understand

    trace(_parent);                     // gives : _level0
    trace(this._parent);                // gives : _level0      
    // this._parent is the same as _parent inside the timeline of our object        

    trace(this);                        // gives : _level0.button1

    // if you want to use the name of your object inside its timeline, you have to use it on reference with its parent 
    trace(this._parent[this._name]);    // gives : _level0.button1
    trace(this._parent['button1']);     // gives : _level0.button1
    trace(this._parent.button1);        // gives : _level0.button1

    // then you can pick a choice between all these notation : 

    var _this = this._parent['button1'];// this, this._parent[this._name] or this._parent.button1

    // to hide the object using setProperty
    setProperty(_this, _visible, false);

    // or simply without setProperty 
    _this._visible = false;

}
button1.onRelease = function():Void {

    // to hide the object using setProperty, you can do
    setProperty(this, _visible, false);

    // or ( selected by its name )
    setProperty(this._name, _visible, false);

    // or ( selected by its name )
    setProperty('button1', _visible, false);

    // or
    setProperty(button1, _visible, false);

    // or simply without setProperty 
    this._visible = false;

    // or
    button1._visible = false;

    // or, using its name 
    this._parent[this._name]._visible = false;
    this._parent['button1']._visible = false;
    this._parent[button1]._visible = false;

}
如果您在对象的
父对象的时间线内,您可以执行以下操作:

// In my case, the button1 object is inside the root timeline

on (release) {

    // you can use some traces to more understand

    trace(_parent);                     // gives : _level0
    trace(this._parent);                // gives : _level0      
    // this._parent is the same as _parent inside the timeline of our object        

    trace(this);                        // gives : _level0.button1

    // if you want to use the name of your object inside its timeline, you have to use it on reference with its parent 
    trace(this._parent[this._name]);    // gives : _level0.button1
    trace(this._parent['button1']);     // gives : _level0.button1
    trace(this._parent.button1);        // gives : _level0.button1

    // then you can pick a choice between all these notation : 

    var _this = this._parent['button1'];// this, this._parent[this._name] or this._parent.button1

    // to hide the object using setProperty
    setProperty(_this, _visible, false);

    // or simply without setProperty 
    _this._visible = false;

}
button1.onRelease = function():Void {

    // to hide the object using setProperty, you can do
    setProperty(this, _visible, false);

    // or ( selected by its name )
    setProperty(this._name, _visible, false);

    // or ( selected by its name )
    setProperty('button1', _visible, false);

    // or
    setProperty(button1, _visible, false);

    // or simply without setProperty 
    this._visible = false;

    // or
    button1._visible = false;

    // or, using its name 
    this._parent[this._name]._visible = false;
    this._parent['button1']._visible = false;
    this._parent[button1]._visible = false;

}
我知道我的答案本可以简短一些,但我试图澄清一些事情,以便更好地理解它

希望这能有所帮助