Re: [Flashcoders] Recursive Loop showing all items

2005-12-02 Thread John Grden
I would suggest trying Xray as well ;)

all the headache you guys are working through right here has already been
done with Xray

Features:
http://www.osflash.org/xray#features

Downloads:
http://labs.blitzagency.com/?p=45

Video tutorials:
http://labs.blitzagency.com/wp-content/xray/videos/tutorials/indexFlash.html

let me know if you have any questions

John

On 12/1/05, Mark Winterhalder [EMAIL PROTECTED] wrote:

 On 12/2/05, Mark Winterhalder  [EMAIL PROTECTED] wrote:
  On 12/2/05, Marc Hoffman [EMAIL PROTECTED] wrote:
   Jay,
  
   If you got this to work, could you send me the code? I can't make it
   work even when doing the obvious clean-up to the line breaks and
   changing naming conventions to AS2 (e.g. Boolean rather than
 boolean).
 
  you can give the one i just hacked together proper testing, if you
  like, and let me know if it works...

 forgot to check for the tag to avoid unwanted recursion. it didn't
 cause a problem in my initial test because i had limited the recursion
 depth (the ttl argument). sorry for the noise.

 var types:Object = { movieclip: 1, object: 2, array: 4 };
 var objTrace:Function = function( obj:Object, name2:String,
 mask:Number, ttl:Number, indent:String, traceID:String ) {
 if( !indent.length ) indent = \t;
 if( !( traceID.length ) )  traceID = String( getTimer() );
 if( !ttl )  ttl = 0;
 if( !mask )  mask = -1;
 if( !( arguments.callee.$$tag == traceID ) ) {
arguments.callee.$$tag = traceID;
arguments.callee.idCntr = 0;
 }
 var type:String = typeof obj;
 var id:String;
 if( types[ type ] ) {
if( obj.$$id.length )  id = obj.$$id;
else {
  id = obj.$$id = String( arguments.callee.idCntr++ );
  _global.ASSetPropFlags( obj, $$id, 1, 0 );
}
 } else id = ;

 trace( id + indent + name2 +  :  + type + ( id.length ?  : 
 \tvalue:  + obj ) );
 if( !( types[ type ]  mask ) || ( obj.$$tag == traceID ) )  return;
 obj.$$tag = traceID;
 _global.ASSetPropFlags( obj, $$tag, 1, 0 );
 indent += \t;
 if( !( --ttl ) ) return;
 for( var i:String in obj )
arguments.callee( obj[ i ], i, mask, ttl, indent, traceID );
 };


 usage:
 (if it works at all)

 objTrace( object, name, mask, ttl );
 where:
 object is the root object of the trace, e.g. _root,
 name is the name of the first object, e.g. _root
 mask defines which kind of objects to follow, you define it by adding
 their respective bits as defined in the types object in the first
 line. so, 1 would only follow movieclips, 5 would follow movieclips
 and arrys, but not objects (1 + 4), 6 would follow objects and arrays
 (2 + 4), and so on. omitting it (or passing 0) would follow all of
 them. another way is to pass something like that: ( types[ movieclip
 ] | types[ object ] | types[ array ] ), with the ones you want to
 include.
 ttl is the time to live, e.g. the depth of the recursion. 0 is unlimited.
 indent and traceID are best omitted initially.

 so, to trace all, you would simply say:
 objTrace( _root, _root );
 to trace all clips, but not objects and arrays:
 objTrace( _root, _root, 1 );
 to trace all clips and all objects, but only to the grandchildren of root:
 objTrace( _root, _root, 3, 3 );
 and so on.

 --
 http://snafoo.org/
 jabber: [EMAIL PROTECTED]
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




--
John Grden - Blitz
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Recursive Loop showing all items

2005-12-02 Thread John Grden
OH, and I forgot  to mention:  Xray's open source ;)  You can look through
the recursion method it uses if you REALLY want to.  It's not perfect (yet),
but it definately works, and any and all suggestions/help are welcome.

https://secure.sourcesecure.co.uk/trac/osflash/xray/browser/DEV_Source/xray/classes/com/blitzagency/xray/ObjectViewer.as

John

On 12/2/05, John Grden [EMAIL PROTECTED] wrote:

 I would suggest trying Xray as well ;)

 all the headache you guys are working through right here has already been
 done with Xray

 Features:
 http://www.osflash.org/xray#features

 Downloads:
 http://labs.blitzagency.com/?p=45

 Video tutorials:

 http://labs.blitzagency.com/wp-content/xray/videos/tutorials/indexFlash.html

 let me know if you have any questions

 John

 On 12/1/05, Mark Winterhalder [EMAIL PROTECTED] wrote:
 
  On 12/2/05, Mark Winterhalder  [EMAIL PROTECTED] wrote:
   On 12/2/05, Marc Hoffman  [EMAIL PROTECTED] wrote:
Jay,
   
If you got this to work, could you send me the code? I can't make it
 
work even when doing the obvious clean-up to the line breaks and
changing naming conventions to AS2 (e.g. Boolean rather than
  boolean).
  
   you can give the one i just hacked together proper testing, if you
   like, and let me know if it works...
 
  forgot to check for the tag to avoid unwanted recursion. it didn't
  cause a problem in my initial test because i had limited the recursion
  depth (the ttl argument). sorry for the noise.
 
  var types:Object = { movieclip: 1, object: 2, array: 4 };
  var objTrace:Function = function( obj:Object, name2:String,
  mask:Number, ttl:Number, indent:String, traceID:String ) {
  if( !indent.length ) indent = \t;
  if( !( traceID.length ) )  traceID = String( getTimer() );
  if( !ttl )  ttl = 0;
  if( !mask )  mask = -1;
  if( !( arguments.callee.$$tag == traceID ) ) {
 arguments.callee.$$tag = traceID;
 arguments.callee.idCntr = 0;
  }
  var type:String = typeof obj;
  var id:String;
  if( types[ type ] ) {
 if( obj.$$id.length )  id = obj.$$id;
 else {
   id = obj.$$id = String( arguments.callee.idCntr++ );
   _global.ASSetPropFlags( obj, $$id, 1, 0 );
 }
  } else id = ;
 
  trace( id + indent + name2 +  :  + type + ( id.length ?  : 
  \tvalue:  + obj ) );
  if( !( types[ type ]  mask ) || ( obj.$$tag == traceID ) )  return;
  obj.$$tag = traceID;
  _global.ASSetPropFlags( obj, $$tag, 1, 0 );
  indent += \t;
  if( !( --ttl ) ) return;
  for( var i:String in obj )
 arguments.callee( obj[ i ], i, mask, ttl, indent, traceID );
  };
 
 
  usage:
  (if it works at all)
 
  objTrace( object, name, mask, ttl );
  where:
  object is the root object of the trace, e.g. _root,
  name is the name of the first object, e.g. _root
  mask defines which kind of objects to follow, you define it by adding
  their respective bits as defined in the types object in the first
  line. so, 1 would only follow movieclips, 5 would follow movieclips
  and arrys, but not objects (1 + 4), 6 would follow objects and arrays
  (2 + 4), and so on. omitting it (or passing 0) would follow all of
  them. another way is to pass something like that: ( types[ movieclip
  ] | types[ object ] | types[ array ] ), with the ones you want to
  include.
  ttl is the time to live, e.g. the depth of the recursion. 0 is
  unlimited.
  indent and traceID are best omitted initially.
 
  so, to trace all, you would simply say:
  objTrace( _root, _root );
  to trace all clips, but not objects and arrays:
  objTrace( _root, _root, 1 );
  to trace all clips and all objects, but only to the grandchildren of
  root:
  objTrace( _root, _root, 3, 3 );
  and so on.
 
  --
  http://snafoo.org/
  jabber: [EMAIL PROTECTED]
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 



 --
 John Grden - Blitz




--
John Grden - Blitz
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Jay Lepore
Hello,

Can anyone provide with a recursive loop that loops through every mc and
further loops through every child mc's listing every movieclip, string,
object etc along the way?

I know such code is out there and rather than recreate the wheel I
thought I'd tap the experts on it.

What sayeth the group?

Jay
FlashBOMB.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Recursive Loop showing all items

2005-12-01 Thread David Rorex
On 12/1/05, Jay Lepore [EMAIL PROTECTED] wrote:
 Hello,

 Can anyone provide with a recursive loop that loops through every mc and
 further loops through every child mc's listing every movieclip, string,
 object etc along the way?

 I know such code is out there and rather than recreate the wheel I
 thought I'd tap the experts on it.

 What sayeth the group?

 Jay
 FlashBOMB.com

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

function go(mc)
{
   trace(mc);
   for(i in mc)
   go(mc[i]);
}
go(_root);

-David R
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Steve Mathews
Look at Xray on osflash.org (site not coming up for me right at the moment).

On 12/1/05, Jay Lepore [EMAIL PROTECTED] wrote:
 Hello,

 Can anyone provide with a recursive loop that loops through every mc and
 further loops through every child mc's listing every movieclip, string,
 object etc along the way?

 I know such code is out there and rather than recreate the wheel I
 thought I'd tap the experts on it.

 What sayeth the group?

 Jay
 FlashBOMB.com

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Jay Lepore
Hello,

Can anyone provide with a recursive loop that loops through every mc and
further loops through every child mc's listing every movieclip, string,
object etc along the way?

I know such code is out there and rather than recreate the wheel I
thought I'd tap the experts on it.

What sayeth the group?

I had received a response to this previously, however, just the a blank
stage with the Macromedia standard scrollBar component dragged onto it
would result in the error:
256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie.

So I'm guessing there's a break feature missing in the code somewhere.

Jay
FlashBOMB.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Marc Hoffman

Jay,

If you got this to work, could you send me the code? I can't make it 
work even when doing the obvious clean-up to the line breaks and 
changing naming conventions to AS2 (e.g. Boolean rather than boolean).


Thanks,
Marc

At 04:39 PM 12/1/2005, you wrote:

Ok, this may be a first. I'm going to go ahead and answer my own posting
with a solution I found from a long time ago.

Here you go Jay :-)

This is the solution:
/* will result in recursive listing of all objects within all objects */
_global.traceObjects = function (obj, recursive, restrictTo) {
// potential restrictTo's include:
//
movieclip,number,boolean,string,undefined,object,function,null;
//
for (item in obj) {
var objDepth = obj.getDepth();
var objHeight = obj[item]._height;
if (restrictTo.length0  typeof (obj[item]) ==
restrictTo) {
//  traceResults+=Found: +typeof (obj[item])+
+item+ at depth +objDepth+\n;
traceResults+=typeof (obj[item])+
+obj+.+item+ height = +objHeight+\n;
}
if (restrictTo.length1) {
//  traceResults+=Found: +typeof (obj[item])+
+item+ at depth +objDepth+\n;
traceResults+=typeof (obj[item])+
+obj+.+item+ height = +objHeight+\n;
}
if (recursive == true) {
traceObjects(obj[item], restrictTo);
}
}
return traceResults;
};



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jay
Lepore
Sent: Thursday, December 01, 2005 4:07 PM
To: 'Flashcoders Mailing List'
Subject: [Flashcoders] Recursive Loop showing all items


Hello,

Can anyone provide with a recursive loop that loops through every mc and
further loops through every child mc's listing every movieclip, string,
object etc along the way?

I know such code is out there and rather than recreate the wheel I
thought I'd tap the experts on it.

What sayeth the group?

I had received a response to this previously, however, just the a blank
stage with the Macromedia standard scrollBar component dragged onto it
would result in the error: 256 levels of recursion were exceeded in one
action list. This is probably an infinite loop. Further execution of
actions has been disabled in this movie.

So I'm guessing there's a break feature missing in the code somewhere.

Jay
FlashBOMB.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Mark Winterhalder
On 12/2/05, Marc Hoffman [EMAIL PROTECTED] wrote:
 Jay,

 If you got this to work, could you send me the code? I can't make it
 work even when doing the obvious clean-up to the line breaks and
 changing naming conventions to AS2 (e.g. Boolean rather than boolean).

you can give the one i just hacked together proper testing, if you
like, and let me know if it works...

var types:Object = { movieclip: 1, object: 2, array: 4 };
var objTrace:Function = function( obj:Object, name2:String,
mask:Number, ttl:Number, indent:String, traceID:String ) {
  if( !indent.length ) indent = \t;
  if( !( traceID.length ) )  traceID = String( getTimer() );
  if( !ttl )  ttl = 0;
  if( !mask )  mask = -1;
  if( !( arguments.callee.$$tag == traceID ) ) {
arguments.callee.$$tag = traceID;
arguments.callee.idCntr = 0;
  }
  var type:String = typeof obj;
  var id:String;
  if( types[ type ] ) {
if( obj.$$id.length )  id = obj.$$id;
else {
  id = obj.$$id = String( arguments.callee.idCntr++ );
  _global.ASSetPropFlags( obj, $$id, 1, 0 );
}
  } else id = ;

  trace( id + indent + name2 +  :  + type + ( id.length ?  : 
\tvalue:  + obj ) );
  if( !( types[ type ]  mask ) )  return;
  obj.$$tag = traceID;
  _global.ASSetPropFlags( obj, $$tag, 1, 0 );
  indent += \t;
  if( !( --ttl ) ) return;
  for( var i:String in obj )
arguments.callee( obj[ i ], i, mask, ttl, indent, traceID );
};


usage:
(if it works at all)

objTrace( object, name, mask, ttl );
where:
object is the root object of the trace, e.g. _root,
name is the name of the first object, e.g. _root
mask defines which kind of objects to follow, you define it by adding
their respective bits as defined in the types object in the first
line. so, 1 would only follow movieclips, 5 would follow movieclips
and arrys, but not objects (1 + 4), 6 would follow objects and arrays
(2 + 4), and so on. omitting it (or passing 0) would follow all of
them. another way is to pass something like that: ( types[ movieclip
] | types[ object ] | types[ array ] ), with the ones you want to
include.
ttl is the time to live, e.g. the depth of the recursion. 0 is unlimited.
indent and traceID are best omitted initially.

so, to trace all, you would simply say:
objTrace( _root, _root );
to trace all clips, but not objects and arrays:
objTrace( _root, _root, 1 );
to trace all clips and all objects, but only to the grandchildren of root:
objTrace( _root, _root, 3, 3 );
and so on.

hth,
mark

--
http://snafoo.org/
jabber: [EMAIL PROTECTED]
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Recursive Loop showing all items

2005-12-01 Thread Mark Winterhalder
On 12/2/05, Mark Winterhalder [EMAIL PROTECTED] wrote:
 On 12/2/05, Marc Hoffman [EMAIL PROTECTED] wrote:
  Jay,
 
  If you got this to work, could you send me the code? I can't make it
  work even when doing the obvious clean-up to the line breaks and
  changing naming conventions to AS2 (e.g. Boolean rather than boolean).

 you can give the one i just hacked together proper testing, if you
 like, and let me know if it works...

forgot to check for the tag to avoid unwanted recursion. it didn't
cause a problem in my initial test because i had limited the recursion
depth (the ttl argument). sorry for the noise.

var types:Object = { movieclip: 1, object: 2, array: 4 };
var objTrace:Function = function( obj:Object, name2:String,
mask:Number, ttl:Number, indent:String, traceID:String ) {
 if( !indent.length ) indent = \t;
 if( !( traceID.length ) )  traceID = String( getTimer() );
 if( !ttl )  ttl = 0;
 if( !mask )  mask = -1;
 if( !( arguments.callee.$$tag == traceID ) ) {
   arguments.callee.$$tag = traceID;
   arguments.callee.idCntr = 0;
 }
 var type:String = typeof obj;
 var id:String;
 if( types[ type ] ) {
   if( obj.$$id.length )  id = obj.$$id;
   else {
 id = obj.$$id = String( arguments.callee.idCntr++ );
 _global.ASSetPropFlags( obj, $$id, 1, 0 );
   }
 } else id = ;

 trace( id + indent + name2 +  :  + type + ( id.length ?  : 
\tvalue:  + obj ) );
 if( !( types[ type ]  mask ) || ( obj.$$tag == traceID ) )  return;
 obj.$$tag = traceID;
 _global.ASSetPropFlags( obj, $$tag, 1, 0 );
 indent += \t;
 if( !( --ttl ) ) return;
 for( var i:String in obj )
   arguments.callee( obj[ i ], i, mask, ttl, indent, traceID );
};


usage:
(if it works at all)

objTrace( object, name, mask, ttl );
where:
object is the root object of the trace, e.g. _root,
name is the name of the first object, e.g. _root
mask defines which kind of objects to follow, you define it by adding
their respective bits as defined in the types object in the first
line. so, 1 would only follow movieclips, 5 would follow movieclips
and arrys, but not objects (1 + 4), 6 would follow objects and arrays
(2 + 4), and so on. omitting it (or passing 0) would follow all of
them. another way is to pass something like that: ( types[ movieclip
] | types[ object ] | types[ array ] ), with the ones you want to
include.
ttl is the time to live, e.g. the depth of the recursion. 0 is unlimited.
indent and traceID are best omitted initially.

so, to trace all, you would simply say:
objTrace( _root, _root );
to trace all clips, but not objects and arrays:
objTrace( _root, _root, 1 );
to trace all clips and all objects, but only to the grandchildren of root:
objTrace( _root, _root, 3, 3 );
and so on.

--
http://snafoo.org/
jabber: [EMAIL PROTECTED]
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders