xxlm
01-12-2006, 04:13 AM
Hello there.
Ok I made a preloader component (check webbymx.net ressources section).
The thing is I have some trouble with the _targetInstanceName.
If I'm putting the [Inspectable] tag before the variable define at the beginning of the class, it works great. I'm draging my component on my movieclip and the _targetInstanceName is set and I can see it in the property panel.
BUT ... yes there is a but ...
I'm using another variables too that need to be define too by the user in the property panel. The thing is I need to use a set method to set this variable as I need to apply some change on it.
the user give a string for the name of a textfield and I'm doing something like
mytextfield = _targetInstanceName[inputstring];
Seems good.
The thing is with this configuration,
class ... {
[Inspectable(name="_targetInstanceName")]
private var _targetInstanceName:MovieClip;
...
[Inspectable(name="File name (TextField Path)", defaultValue="txt_filename")]
public function set fileName (s:String) {
trace(targetInstanceName); // output undefined
_tFileName = _targetInstanceName[s];
}
}
the _targetInstanceName variable is not know still.
I found that I have to put the Inspectable tag front of a setter like this
class ... {
private var _targetInstanceName:MovieClip;
...
[Inspectable(name="_targetInstanceName")]
public function set targetInstanceName (s:String) {
_targetInstanceName = this._parent[s];
}
[Inspectable(name="File name (TextField Path)", defaultValue="txt_filename")]
public function set fileName (s:String) {
trace(targetInstanceName); // output the reference of my movieclip
_tFileName = _targetInstanceName[s];
}
}
but now, when I'm dragging and dropping the component on my movieclip, the _instanceTargetName is not automatically set. I have to do it by hand. (Going in the property panel and writing the name of my movieclip)
Any idea why? and how I can fix this?
Thx you much :)
C ya
Ok I made a preloader component (check webbymx.net ressources section).
The thing is I have some trouble with the _targetInstanceName.
If I'm putting the [Inspectable] tag before the variable define at the beginning of the class, it works great. I'm draging my component on my movieclip and the _targetInstanceName is set and I can see it in the property panel.
BUT ... yes there is a but ...
I'm using another variables too that need to be define too by the user in the property panel. The thing is I need to use a set method to set this variable as I need to apply some change on it.
the user give a string for the name of a textfield and I'm doing something like
mytextfield = _targetInstanceName[inputstring];
Seems good.
The thing is with this configuration,
class ... {
[Inspectable(name="_targetInstanceName")]
private var _targetInstanceName:MovieClip;
...
[Inspectable(name="File name (TextField Path)", defaultValue="txt_filename")]
public function set fileName (s:String) {
trace(targetInstanceName); // output undefined
_tFileName = _targetInstanceName[s];
}
}
the _targetInstanceName variable is not know still.
I found that I have to put the Inspectable tag front of a setter like this
class ... {
private var _targetInstanceName:MovieClip;
...
[Inspectable(name="_targetInstanceName")]
public function set targetInstanceName (s:String) {
_targetInstanceName = this._parent[s];
}
[Inspectable(name="File name (TextField Path)", defaultValue="txt_filename")]
public function set fileName (s:String) {
trace(targetInstanceName); // output the reference of my movieclip
_tFileName = _targetInstanceName[s];
}
}
but now, when I'm dragging and dropping the component on my movieclip, the _instanceTargetName is not automatically set. I have to do it by hand. (Going in the property panel and writing the name of my movieclip)
Any idea why? and how I can fix this?
Thx you much :)
C ya