Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript help - trying to understand code

Status
Not open for further replies.

spurs100

Technical User
Jun 5, 2002
20
GB
Hi all,



I am a beginner actionscripter, i am trying to learn by analysing other peoples code.



Please can anyone help answer some questions about the following snipet of Actionscript so that i may understand it!!



Frame 1 the following variables are decleared



i = "1";

row = "1";

columns = "2";

tak = "1";

netak = "1";

column = "2";



Frame 2 the following code is placed:



column = columns;

row = netak;

while (Number(column)>Number(tak)) {

if (Number(row)<16 and Number(column)<43) {

duplicateMovieClip(&quot;c&quot;, &quot;c&quot; add i, 900-i);

setProperty(&quot;c&quot; add i, _rotation, column*45);

setProperty(&quot;c&quot; add i, _x, Number(column*5)+160);

setProperty(&quot;c&quot; add i, _y, Number(row*5)+179);

}

row = Number(row)+1;

column = column-1;

i = Number(i)+1;

}



What i understand from this portion of the code is that new variables are declared, but why? They do not appear in the code after they are declared, i am confused what purpose they have. As when i take them out the effect does not work properly so they must have some function!.



I understand that the while statement specifies that the IF condition should run so long as the value of the variable ìcolumnî is greater than the value of the variable ìtakî. When will the condition be met so that the loop stops as the value of the variable ìtakî remains constant and the value of the variable ìcolumnî only decreases by 1 each loop if the condition in the IF statement is false?



Also when will th IF condition be false?



I am trying to figure out why the numbers 16 and 43 were used in the IF statement.



I know its a lot to ask, hope i have made myself understood, if anyone needs, i can email the fla that i am attempting to analyse.





A million thanks in advance



 
You seem to be a little confused about conditionals. Statements following an IF statement are executed whether or not the IF statement is true.

The point behind this code seems to be creating duplicates of a movieclip called 'c'. The effect that doesn't work without this code must be caused by these duplicates. Find 'c' and see what it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top