actionscript 3 - duplicateMovieClip in Action Script 3 -


my question how this: https://www.dropbox.com/s/zi63y771h38a2vo/example.fla

in action script 3.0.

this working timeline source code, ready indexing values + sorting news via array. simple that, how create same thing in actionscript 3.0?

i searching on websites/forums , couldn't find answer satisfying me, decided create account in here , ask help.

if remake example on actionscript 3.0, all, because saw lot of questions duplicatemovieclip() function, there no strict answer + example on it, maybe let's create this?

this suggestion, code in file or here:

    stop();      var idmovieclip = 0;     var idarray = 0;     var duplicate:movieclip;     mc._visible = false;     var array:array = new array();      enter.onrelease = function() {         duplicate = mc.duplicatemovieclip(idmovieclip, _root.getnexthighestdepth());          var ref = eval(duplicate);         ref.id = idmovieclip;         ref.sortedid = idarray;          _root[ref.id].windowid.text = "id: " + ref.id;          duplicate.close.onrollover = function() {             trace(_root[ref.id]._target);         };          duplicate.close.onrelease = function() {             _root.array.splice(_root[ref.id].sortedid,1);             removemovieclip(_root[ref.id]);             idarray -= 1;             _root.dosort();         };          array.push([idarray, idmovieclip]);         dosort();          idmovieclip += 1;         idarray += 1;     };      dosort = function () {         (var = 0; < array.length; i++) {             _root[array[i][1]]._y = 10 + ((_root[array[i][1]]._height + 10) * i);             _root[array[i][1]].sortid.text = i;             _root[array[i][1]].sortedid = i;             trace(array[i]);         }     }; 

fla project design in jpg (movieclips/placement etc)

(what need run it, if dont want download dropbox)

if help, great.

there no duplicatemovieclip in as3, in actionscript 3, instantiate movie clips. didn't find place used variables, think it's part of project, should adapt code needs. should read bit export actionscript.

//container objects             var movieholder: sprite = new sprite(); var id:uint = 0; const padding: int = 10;  //handler, add new objects scene enter.addeventlistener(mouseevent.click, onclickenter);  addchild(movieholder);  movieholder.x = movieholder.y = padding;  function onclickclose(e:mouseevent):void {     movieholder.removechild(displayobject(e.currenttarget).parent);     sortmovies(); }  function onclickenter(e:mouseevent):void {     //set movieclip form export actionscript     var movie:myformmovie = new myformmovie();     movie.windowid.text = "id: " + id;     movie.close.addeventlistener(mouseevent.click, onclickclose, false, 0, true);     movieholder.addchild(movie);     sortmovies();     id++; }  function sortmovies():void {     var i: uint, len: uint = movieholder.numchildren, movie: myformmovie;     var posy: uint;      for(i; < len; ++i){         movie = movieholder.getchildat(i) myformmovie;         movie.y = posy;         movie.sortid.text = i.tostring();         posy += movie.height + padding;     } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -