2015-01-20 4 views
-1

친구, 플래시 연습을 만들고 싶습니다. 내가 그것을 숨기거나 사라져야하는 객체를 클릭하면. 버튼의 타임 라인 내부에 있기 때문에 그래서 여기 클릭하면 플래시에서 버튼을 숨기려고합니다.

setProperty(target:Object, property:Object, expression:Object) : Void 

하면 target 될 수있는 객체 자체 또는 이름, 그리고, 당신은 사용할 수 없습니다

on (release) { 
{ 
setProperty("button1",_visible,false); 
} 
} 

답변

0

setProperty 기능은 다음과 같이 사용됩니다 그 이름은 코드에서 직접했던 것과 같습니다.

은 타임 라인 내에서 개체를 얻으려면 귀하의 경우에 당신이 할 수 있도록, 당신은 많은 매너 :

// 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; 

} 

을 그리고 당신은 개체의 parent의 타임 라인 안에있는 경우, 당신은 할 수 있습니다 :

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; 

} 

내 대답은 짧을 수도 있지만 더 명확하게 이해하려고 노력했습니다.

희망이 도움이 될 수 있습니다.