[Flashcoders] [AS3] height not right
*height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] height not right
It measures the height of the actual content. You'd have to have something onstage at (0,0) for it to start measuring there. If you need it, write something that retrieves the Y value of the item plus the item's height, where item is the DisplayObject in the loaded SWF. var functionalHeight:Number = item.y + item.height; --Matt On Sun, Jan 25, 2009 at 10:30 AM, Joel Stransky j...@stranskydesign.comwrote: *height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.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
Re: [Flashcoders] [AS3] height not right
Thanks Matt, I understand I can work out the height manually but I'm trying to write a function into the main stage that can read the height of any child swf. The names and locations may vary so its not that attractive of a solution. There has to be some way of reading the bounds. Like in as2, if you create an empty movieclip, then attach another 20x20 clip to it at a y of 10, that new movieclips height comes back as 30. I'll be seriously pissed to find out adobe dropped yet another useful feature with as3. On Sun, Jan 25, 2009 at 1:51 PM, Matt Gitchell m...@moonbootmedia.comwrote: It measures the height of the actual content. You'd have to have something onstage at (0,0) for it to start measuring there. If you need it, write something that retrieves the Y value of the item plus the item's height, where item is the DisplayObject in the loaded SWF. var functionalHeight:Number = item.y + item.height; --Matt On Sun, Jan 25, 2009 at 10:30 AM, Joel Stransky j...@stranskydesign.com wrote: *height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.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 -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] height not right
I dunno, man, I don't remember what that returned in AS2 (it's been a couple years since I used it), but I would seriously get annoyed if AS3 returned a height based on a non-existent piece of content. Right now, it sniffs out the bounds of the displayobject then returns the height of that rectangle. seems like the right behavior to me, and I can think of many projects that I've worked on, certainly, where the other implementation would be maddening. I do still find it fascinating that folks keep railing about AS3 vs. AS2, esp. when we're now 2 revs of the IDE out of AS2...that's a value neutral statement, by the way, people like what they like. --Matt On Sun, Jan 25, 2009 at 11:06 AM, Joel Stransky stranskydes...@gmail.comwrote: Thanks Matt, I understand I can work out the height manually but I'm trying to write a function into the main stage that can read the height of any child swf. The names and locations may vary so its not that attractive of a solution. There has to be some way of reading the bounds. Like in as2, if you create an empty movieclip, then attach another 20x20 clip to it at a y of 10, that new movieclips height comes back as 30. I'll be seriously pissed to find out adobe dropped yet another useful feature with as3. On Sun, Jan 25, 2009 at 1:51 PM, Matt Gitchell m...@moonbootmedia.com wrote: It measures the height of the actual content. You'd have to have something onstage at (0,0) for it to start measuring there. If you need it, write something that retrieves the Y value of the item plus the item's height, where item is the DisplayObject in the loaded SWF. var functionalHeight:Number = item.y + item.height; --Matt On Sun, Jan 25, 2009 at 10:30 AM, Joel Stransky j...@stranskydesign.com wrote: *height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.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 -- --Joel Stransky stranskydesign.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
Re: [Flashcoders] [AS3] height not right
Well I think I have something to work with. I found that I can just getBounds() on the element in question and add the returned Rectangles .y to its .height. I'd like a simple height prop somewhere but this will work. Now to go post in the other two places I asked this question :) On Sun, Jan 25, 2009 at 2:06 PM, Joel Stransky stranskydes...@gmail.comwrote: Thanks Matt, I understand I can work out the height manually but I'm trying to write a function into the main stage that can read the height of any child swf. The names and locations may vary so its not that attractive of a solution. There has to be some way of reading the bounds. Like in as2, if you create an empty movieclip, then attach another 20x20 clip to it at a y of 10, that new movieclips height comes back as 30. I'll be seriously pissed to find out adobe dropped yet another useful feature with as3. On Sun, Jan 25, 2009 at 1:51 PM, Matt Gitchell m...@moonbootmedia.comwrote: It measures the height of the actual content. You'd have to have something onstage at (0,0) for it to start measuring there. If you need it, write something that retrieves the Y value of the item plus the item's height, where item is the DisplayObject in the loaded SWF. var functionalHeight:Number = item.y + item.height; --Matt On Sun, Jan 25, 2009 at 10:30 AM, Joel Stransky j...@stranskydesign.com wrote: *height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.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 -- --Joel Stransky stranskydesign.com -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] height not right
It's not a I don't like change argument. It's a why remove logically intuitive features without a replacement? one. AS3 is great, but it's not fool proof. On Sun, Jan 25, 2009 at 2:34 PM, Matt Gitchell m...@moonbootmedia.comwrote: I dunno, man, I don't remember what that returned in AS2 (it's been a couple years since I used it), but I would seriously get annoyed if AS3 returned a height based on a non-existent piece of content. Right now, it sniffs out the bounds of the displayobject then returns the height of that rectangle. seems like the right behavior to me, and I can think of many projects that I've worked on, certainly, where the other implementation would be maddening. I do still find it fascinating that folks keep railing about AS3 vs. AS2, esp. when we're now 2 revs of the IDE out of AS2...that's a value neutral statement, by the way, people like what they like. --Matt On Sun, Jan 25, 2009 at 11:06 AM, Joel Stransky stranskydes...@gmail.com wrote: Thanks Matt, I understand I can work out the height manually but I'm trying to write a function into the main stage that can read the height of any child swf. The names and locations may vary so its not that attractive of a solution. There has to be some way of reading the bounds. Like in as2, if you create an empty movieclip, then attach another 20x20 clip to it at a y of 10, that new movieclips height comes back as 30. I'll be seriously pissed to find out adobe dropped yet another useful feature with as3. On Sun, Jan 25, 2009 at 1:51 PM, Matt Gitchell m...@moonbootmedia.com wrote: It measures the height of the actual content. You'd have to have something onstage at (0,0) for it to start measuring there. If you need it, write something that retrieves the Y value of the item plus the item's height, where item is the DisplayObject in the loaded SWF. var functionalHeight:Number = item.y + item.height; --Matt On Sun, Jan 25, 2009 at 10:30 AM, Joel Stransky j...@stranskydesign.com wrote: *height not right* -- Create two .fla's called SizeParent.fla and SizeChild.fla. In SizeChild draw a square of 20x20 and set it's y to 10. Publish SizeChild.swf and place this code on frame 1 in SizeParent Code: import flash.display.*; import flash.events.*; import flash.net.URLRequest; var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(SizeChild.swf)); function onComplete(e:Event):void{ addChild(l); trace(l.content.height); } Shouldn't height be 30? I keep getting 20. What gives? -- --Joel Stransky stranskydesign.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 -- --Joel Stransky stranskydesign.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 -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders