|
|||
|
I'm using SWFkit Pro 2.2 and SWFgen to create a small application where users input text among other things. I keep getting "$EXAMINER1", "$EXAMINER2" etc in the OUTPUT but not the string that I enter in the USER_SIDE and I can't figure out where I am going wrong.
Can anyone see where I'm going wrong? Any help would be appreciated! This is the script in SWFkit Pro 2.2 : Initialize Script: Code:
// the examiner
var exam = obj.string.substr(0, 5);
if (exam == "$EXAM")
{
var index = parseInt(obj.string.substr(5));
obj.string = FlashPlayer.getVariable("_root.examinerCard." + (index - 1));
obj.needSub = true;
return;
}
Code:
// the answers
if (prompt == "$EXAMINER")
{
var index = parseInt(obj.string.substr(7));
obj.string = FlashPlayer.getVariable("_root.examinerCard." + (index - 1));
trace(obj.string);
if (obj.string == "undefined") obj.string = "";
obj.needSub = true;
return;
}
Code:
_root.examinerCard = new Array();
var _l2 = 1;
while (_l2 <= 6)
{
var _l3 = _root["examiner" + _l2];
_root.examinerCard.push(_l3);
_l2++;
} // end while
Code:
on (click)
{
_root.collectExaminerCard();
fscommand("ffish_run", "printanswer");
}
|
|
|||
|
In Flash, examinerCard is declared as an array.
In SWFKit, you use getVariable. You have to use getArray for arrayus and getObject for objects. Take the time to read SWFKit help about those as they work slightly differently than getVariable. Same goes in the other direction. Use putArray and putObject. setVariables is only for the standard type of variables. Also, when you transfer variable content with SWFKit, only string can be transfer so, if you want to transfer a number or a boolean, convert it to a string otherwise you'll get an undefined value in Flash. ex: setVariable("_root.myNumber", aNumber.toString()); |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|