W ten sam sposób zaprogramowałem pole __tipText i setter tipText i dla tego pola już wszystko się ustawia normalnie. Gdzie popełniłem błąd?
Klasa obiektu base:
Kod: Zaznacz cały
class ButtonWithAction extends MovieClip
{
private var tip;
private var __tipText:String;
public function set tipText(value:String):Void {
this.__tipText = value;
}
public function get tipText():String {
return this.__tipText;
}
private var __actionCode:String;
public function set actionCode(value:String):Void {
this.__actionCode = value;
}
public function get actionCode():String {
return this.__actionCode;
}
function ButtonWithAction()
{
tipText = "";
actionCode = "";
}
...
}
Kod: Zaznacz cały
var buttons:Array = Array();
newButtons(Array(Array("Back",true,"Back tip","newPage(1)"),Array("Login",false,"Log tip","newPage(1)")));
ExternalInterface.addCallback("newButtons", this, newButtons);
function newButtons(arr)
{
removeButtons();
//test.text = "bylem"+Math.random();
var m = null;
var front:Number = 0; var back:Number = 0;
for (i:Number = 0; i < arr.length ; i++)
{
m = _root.attachMovie(arr[i][0],arr[i][0]+i,_root.getNextHighestDepth());
if (arr[i][1])
{
m._x = 12 + 60 * front;
front++;
}
else
{
m._x = 730 - 60 * back;
back++;
}
m.base.tipText = arr[i][2]; //tutaj wszystko działa dobrze
m.base.actionCode = arr[i][3]; //tutaj tworzy pole zamiast użyć settera
m._y = 65;
m._visible = true;
buttons.push(m);
}
}
