|
javascript structure problemhi all this time i have a problem with a javascript that should simply change a value inside a given structure. but the dark of the force is not working for me. can any one help? var result = new Object(); var pointsStored = new Array(); var testPoints = [ [-.5,.5,0],[.5,-.5,0],[0.5,0.5,0]]; function (__structure structOut) main (__structure structIn, __boolean mouseDown, __number mouseX, __number mouseY, __number selectionIndex, __index structInCount){ var pointsChanged = new Array(); for (i = 0; i < structInCount; i++){ pointsStored[i] = structIn[i]; } if(selectionIndex >=0 && mouseDown){ testPoints[selectionIndex]= [mouseX, mouseY, structIn[selectionIndex][2], structIn[selectionIndex][3], structIn[selectionIndex][4], structIn[selectionIndex][5], structIn[selectionIndex][6], structIn[selectionIndex][7], structIn[selectionIndex][8] ]; } result.structOut = testPoints; return result; } crap i forgot whom gave me the base for this code but i think i got it from toneburst but it was heavly change by me.... credit to whoom ever. please check the comp inn attach |
ok wrong code: the wright one::)
holy cow batman, no one here! jesus gonna get drunk i am (ioda)...
hey UD, my problem is rather simple. i want to change on the fly an some values from an input structure (structIn) with the mousex and mousey pos. Franz made an example that worked ok but no go for me...as the structure would work out unusefull... but it worked for him and me in his example no for my patch.... but thats not the question. i just want to edit 2 values from a 2d array that enters on the fly in my script and comes out when mouse button is released
ud i am leopard user.,,,,,..... could you help out?
I'l help if you change that scary looking avatar. This site is G rated (no horror)!
Post a comp and explicitly describe which two values in what kind of 2D array you want to change. I don't know what you mean by
For starters you are never passing any other value to the point index input than -1. That means your if statement will never execute (I guess you knew the second part ;-) )
Interestingly with mouse i get proper interaction but with tablet input the mouse down event tends to be sticky taking up to 1 second to go back to zero after the mouse is released. This is the kind of shitty QC interaction that has driven me batty in the past. You spend days working on a big comp and there's a QC bug you can do sweet fanny adams about. Partly why I spend less time amusing myself in QC these days!
QUOTE: For starters you are never passing any other value to the point index input than -1. That means your if statement will never execute (I guess you knew the second part ;-) ) END QUOTE
yes i am when when i hit the white sqares the value changes... and that value goes into the script... as the comp you sent back is working and the value changes :) but it doesn't get into the new structure that i want to make.... check out the new avatar hope you like this one :)
simply try to change the array inside the if statement (pointsStored) WITH the one predefined in testPoints... and you will see what i mean.
hugs bern
i guess the question is quite simple.... why does the script does not function if i input an structure into an array inside it. but it works/evaluates if the array is predefined inside the script?
hugs bern
I think what you're asking is why can't you assign a 2D array to another array. If that's it this comp explains the referencing (pointer) issue of assigning one object to another.
For a=my_array; lazy typing will assign a pointer to the object if it's a structure being assigned.
Look at the comp. I input an array and copy it into a part of the larger internal array.
I also show how altering a pointer to an Array alters the Array being pointer at not what you may think is a new independent Array.
I also show how to copy all the elements of one array to another array.
Cwright sent me a recursive version of same for making Log() statements for objects that will continuously drill down until it hits an unstructured item in the object being Logged. Can;t find it though :-\
Would be nice if Mr Wright reposted in this thread or perhaps in the nascent Javascript wiki. I can't even find the Javascript Wiki on kineme.net although I thought I'd seen something here in the past. Usability of kineme wiki not good, can't wait for the forum update! </eye-rolling ;-) >
I'm not getting any value other than -1.
I went back to original file incase my resizing the comp had effected you hit testing calculations. Definitely no hits when I click the white rects.
Very strange indeed. I've never heard of a comp not working for someone on the same OS X version if there are no plugins to consider.
well i know about referencing but still i don't get where i am failing though.... dumb me....
I also demonstrated how to insert an array into another larger array. Including one from an input port on the JS patch. Not dumb, lazy, well perhaps…
If you have specific questions ask them. Help us to help you!
My initial thought is your trying to store a different set of values dimensionally into your store array that is already filled. It seems however useful designs is stating this is possible if I am reading correctly. I will look into this a little bit more later. Culd be useful patch for vertex points.
crap on me.... dumb me... not lazy never lazy - those are the REALLY DUMB persons! my english is kind a "in trouble".... please check the patch in attach for what i need...
i need to do is this:
i have two values (numbers) that make a struct comming out from the script and then go into and 2d array.
please do check the patch in attach for what i need... its better than my english. i'm having a problem with (from debug:) 18:00:34.580 ["JavaScript" @ "Macro Patch"] > Call Function 0 18:00:34.581 ["JavaScript" @ "Macro Patch"] > TypeError: No default value
18:00:34.581 ["JavaScript" @ "Macro Patch"] > Execution failed at time 5.193
ok so i am almost there .... soon to be back...
ahhh ok i found it ..... my mistake completely... the problem the recursive copy of arrays......
nope... no go recursive copy is the way....