If anybody could identify my misconception here I be very grateful:
You're assuming that you can modify inputs -- you can't.
You're assuming that JS copies by value -- it doesn't (it copies by
reference).
So, when you assign glyph to an input: glyph = glyphs[cursor];
glyph is a reference to the input -- trying to modify that will fail.
You need a copy function, as follows:
function copy(obj)
{
var newObj = new Object();
for(var e in obj)
newObj[e] = obj[e];
return newObj;
}
cursor = 5;
function (__structure Glyphs_Out, __boolean Same, __string Font,
__structure Glyph)
main (__structure Glyphs_In)
{
var result = new Object();
var glyph = new Object();
var glyphs = new Array();
var font = new String();
font = "LucidaGrande";
if (!_testMode)
{
glyphs = Glyphs_In;
glyph = copy(glyphs[cursor]);
// This line works:
font = glyph.Font_Name;
glyph.Font_Name = font;
glyph.Y +=0.1;
// Can't modify inputs, so you'll have to copy some other
inputs too.
//glyphs[cursor]["Y"] +=0.1;
result.Font = font;
result.Glyph = glyph;
result.Glyphs_Out = glyphs;
return result
}
}
Hope that helps! :)
--
[ christopher wright ]
[email protected]
http://kineme.net/
--
[ christopher wright ]
[email protected]
http://kineme.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [email protected]