Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


MovieClip.oopath

Flash Version: FLASH MX
Author: flash@heyday.de
Total downloads: 14065
Category: MovieClip
Publish Date: 2004-03-07 22:29:58

the code:
// oopath
// flash@heyday.de
// http://www.heyday.de/
//
// returns the target of a mc
// but with dots, not slashes
// ( like: _root.my_movie.an_other_movie )

MovieClip.prototype.oopath = function () {
  return_str = "";
  ti         = "";
  do {

    // bei jedem durchgang wird das
    // eltern-element ( parent ) des
    // vorherigen durchgangs genommen
    if ( ti != "" ) {
      ti += "_parent.";
   } else {
      ti = "this.";
   }

    // ermittlung des namens vom
    // aktuellen mc
    tn  = eval( ti add "_name" );

    // wenn der erste durchgang
    if ( return_str != "" ) {
      // wird ein punkt dazwischen gehangen
      tn +=  ".";
    }

    // wenn root-ebene erreicht
    if ( tn == "." || tn == "" ) {
      // wird auch root angezeigt
      tn  = "_root.";
    }

    return_str = tn add return_str;
  } while ( tn != "_root." );

  // ausgabe des pfades
  return return_str;

} // MovieClip.prototype.oopath
// verstecken des prototypes
ASSetPropFlags(MovieClip, "oopath", 1);



// USAGE:

oo_p = this.oopath();

returns something like:
_root.my_movie.an_other_movie

for a better handling of flash studio pro

Comments (1)

g.sebastian on 23rd March 2004

????
trace(this)
trace(String(this))