This content has been marked as final. Show 7 replies
* the params within your function displayPic should only be listed by their var names, not their var names and their data types *
copy and paste the code i have written you below into a new flash document on frame one of the _root, observe the code, test the movie, and check your output window. you will see how passing arguments to a function is as simple as 1, 2, 3.
Thank you. Oddly, the examples I was following all included the type.
there's no problem with your first code, there's no problem with the trace() results and there's no problem typing function parameters.
what did you think was going wrong?
kglad is right, there is no problem with including the data type of a var within a function's parameters. in fact, you can even define a variable, including its data type, to be used within a function specifically within that function's params. i told you not include the data types of your vars within your function's params because you had already defined them at the top of your code, so i felt there was no need to to do it again. i should have been more clear about why i told you to do that - my apologies.
klad, the trace results were not correct. The second results should have reflected the values passed into the function. The process worked as expected when I removed the data types from within the function definition.
i just copied and pasted the original code you attached to this thread into flash and kglad is right. there is no problem with any of it. i didn't check your values before i altered your code originally, i just assumed they were outputting the values you posted. if you will copy and paste your original code back into flash and check the output window you will see what kglad is talking about.
just so you know, all the advice i've ever seen in this forum from kglad has been spot on. definitely use his advice.
i don't see any problem. i believe you may be confused by your own trace statements: your first trace statement is for the 2nd parameter and your 2nd trace statement is your first parameter. that may be causing some confusion.