actionscript 3 - How can i get a function to use any movie clip? -


i'm little lost in understanding kind of function, feeling has been asked thousand times cannot find explanation of code doing.

basically want movie clip instance name box something, reuse function other movie clips afterwards

a little this, working.

many thanks

//my function used on "instance name" box myfunc (box);  function myfunc (); {     while (this happening);     {     //in case box.x = goes ever put     .x = goes here     .y = goes here     } } 

sorry it's not quite english, communication skills terrible

sure can that. give function parameter, refer parameter change properties. such simple movement function accept displayobject - distant superclass of movieclip , superclass many other possible classes of objects can displayed flash.

function myfunc(param:displayobject):void {     // no semicolon after declaring function!     while (somethingishappening(param)) {         // why not call query on object?         param.x+=1; // move right 1 pixel     } } 

you might want @ this manual on actionscript 3 syntax, , following pages on variables, functions , classes, learn more.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -