views:

210

answers:

1

In the Flash 10 player, suppose I've loaded a Sprite that's just a dozen random lines. Is there any way to inspect that Sprite's graphics object and find out the positions of those lines?

Currently I have a crazy work around where I draw the lines to a bitmap and inspect the bitmap, but this is crude and expensive.

+1  A: 

No and yes.

There's no especially convenient way, but it is possible. Check out Claus Wahlers blog post on the subject. It's a great read.

grapefrukt
Thanks for sending me in that direction. I learned a great deal, and I thought the as3swf library was going to all solve my problems. Unfortunately, I discovered that the graphics object does not get serialized when you use byteArray.writeObject(mySprite). So I can't figure out any way to get the Sprite's graphics object into the bytearray. (It's just one of many in a fairly large swf, so parsing the entire swf with as3swf isn't practical.)Any thoughts?
Matt W
can you explain why you need to do it this way, maybe there's a more clever way to get at the lines "earlier" in what i imagine is somekind of export process?
grapefrukt
Right. I'm the using the Flash IDE as an erstaz level builder for a game, and I have collision lines (and trigger volumes, camera guides and a couple of other things) all over the place. The swf export does seem like the next place to go. Though now that I'm looking at it, I'm thinking I will explore parsing the whole swf on load. Getting at that vector info could be useful for lots of reasons. For example, I could rewrite a character's fill colors on the fly (my current method of pixel threshold test and swap is clunky.) I'd greatly appreciate any thoughts you had.
Matt W
check this out: http://debreuil.com/v2d/
grapefrukt
Parsing the level with as3swf on load and digging out all the vector info seems to be working. The fact that the binary load doesn't bring in anything linked with RSL is a bit of a problem, but I can work around it for now. Thanks for your help!
Matt W