Label

  • ActionScript 2
  • AD Player 2
  • Algorithm 2
  • AS3 16
  • Audio 1
  • Audio Description Player 1
  • Bitmap 1
  • BitmapData 1
  • Browser 1
  • C# Experience 4
  • Chart 1
  • Flash 10
  • Game 1
  • Geometry 1
  • JavaScript 2
  • Mathematics 6
  • Music Online 1
  • MVC 1
  • Performance 1
  • PureMVC 1
  • Slide 1
  • Talks 1
  • Tool 1
  • Tool Player 1
Toggle Side
Home   »   Flash   »   Read all the node of MovieClip

Read all the node of MovieClip

You can write a small tool to read all the MovieClip, take very easy!
My simple code:
/*
* read all and push to list
*/
private function readObject(mc:Object):void {
var mcs:* = null;
var mci:* = null;
for (var i:int = 0; i < mc.numChildren; i++ ) {
mcs = mc.getChildAt(i);
list.push(mcs);
if (mcs is MovieClip) {
if (mcs.numChildren > 0) {
readObject(mcs);
}
}
}
}
/**
* Example:
* input: object[child]
* output: string[root.parent.parent.child]
* @param object
* @return string
*/
private function readParent(object:*):String {
var str:String = "";
if (object != null) {
var temp:Array = new Array();
while (object.parent != null) {
temp.push(object.name);
object = object.parent;
}
temp = temp.reverse();
}
return String(temp).split(",").join(".");
}

Demo




Labels: AS3 ,  Flash   at:  4:25 PM     Email This BlogThis! Share to X Share to Facebook

0 comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments ( Atom)
© Hung Le 2007-2016. Powered by Blogger