Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle (0,0,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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] Rectangle doesnt have scaleX/Y?
Hi Matt, It's quite obvious that Rectangle doesn't have scaleX and scaleY. Why would you need it for the Rectangle class anyway? What use for it could you possible have? / Viktor H On Wed, 28 May 2008 16:43:04 +0200, Matt S. [EMAIL PROTECTED] wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle(0,0,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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] Rectangle doesnt have scaleX/Y?
Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. Look up the public properties of the Rectangle class and you'll see scaleX and scaleY don't exist. Draw the rectangle in a Sprite and scale the Sprite instead. -Ricky ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
If you take a look at the Rectangle public properties scaleX and scaleY is not listed: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/geom/Rectangle.html#propertySummary Maybe you can wrap the rectangle with a sprite and then you can scaleX and scaleY ..helmut On Wed, May 28, 2008 at 10:10 AM, Matt S. [EMAIL PROTECTED] wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle(0,0,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 -- ...helmut ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
to add to Sid's comments From the docs: *Note:* The Rectangle class does not define a rectangular Shape display object. To draw a rectangular Shape object onscreen, use thedrawRect() method of the Graphics class. ...Sid... could you elaborate on using the Rectangle class to measure objects on the stage? On Wed, May 28, 2008 at 10:15 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, For what do you want to use the Rectangle? Normally you would use it for instance to measure objects on the stage (at least i do ) For what you are doing cant you use a Shape? or a Sprite? Sid On May 28, 2008, at 5:10 PM, Matt S. wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle(0,0,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- ...helmut ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
Hi Matt, For what do you want to use the Rectangle? Normally you would use it for instance to measure objects on the stage (at least i do ) For what you are doing cant you use a Shape? or a Sprite? Sid On May 28, 2008, at 5:10 PM, Matt S. wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle (0,0,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Rectangle doesnt have scaleX/Y?
Ofcourse :) Right now I'm working on a project that does involve a scrollbar. What i do with the Rectangle class is i measure the handle of the scrollbar and use it for the bounds to drag it to. Like so: _maxScroll = _track.height - _handler.height; _bounds = new Rectangle( _handler.x, _handler.y, 0, _maxScroll ); And then in my function where i do the actual dragging, i do this: _handler.startDrag( false, _bounds ); If you look at the documentation for the Rectangle Class it also says this: The following methods and properties use Rectangle objects: * The bounds parameter for the startDrag() method of the Sprite class Hope this makes sense, to me it does :) Sid On May 28, 2008, at 5:33 PM, Helmut Granda wrote: to add to Sid's comments From the docs: *Note:* The Rectangle class does not define a rectangular Shape display object. To draw a rectangular Shape object onscreen, use thedrawRect() method of the Graphics class. ...Sid... could you elaborate on using the Rectangle class to measure objects on the stage? On Wed, May 28, 2008 at 10:15 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, For what do you want to use the Rectangle? Normally you would use it for instance to measure objects on the stage (at least i do ) For what you are doing cant you use a Shape? or a Sprite? Sid On May 28, 2008, at 5:10 PM, Matt S. wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle (0,0 ,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- ...helmut ___ 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] Rectangle doesnt have scaleX/Y?
On Wed, May 28, 2008 at 11:04 AM, Viktor Hesselbom [EMAIL PROTECTED] wrote: Hi Matt, It's quite obvious that Rectangle doesn't have scaleX and scaleY. Why would you need it for the Rectangle class anyway? What use for it could you possible have? What use could I possibly have? well, one use... I used it to calculate the draggable area of an object using startDrag(), and that worked well, like so: var rectangle:Rectangle = new Rectangle(e.currentTarget.parent.gutter.x,e.currentTarget.parent.gutter.y,e.currentTarget.parent.gutter.x,e.currentTarget.parent.gutter.y+e.currentTarget.parent.gutter.height-e.currentTarget.height); e.currentTarget.startDrag(false,rectangle); But then I tried to use it for calculating image size and positioning prior to the image being loaded, and thats where I ran into the Scale problem. Anyhow, I used an old fashioned Maths to calculate it instead, so I'm good, thanks to all for the suggestions. .m ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Rectangle doesnt have scaleX/Y?
A rectangle is invisible, instead of using the scale properties that don't exist; maybe you can calculate the real width and height values? Or If your problem is keeping a ratio, maybe this post on my blog will help? http://www.soundstep.com/blog/2008/05/08/background-fitting-the-browser-and- image-ratio/ Romu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sidney de Koning Sent: 28 May 2008 16:48 To: Flash Coders List Subject: Re: [Flashcoders] Rectangle doesnt have scaleX/Y? Ofcourse :) Right now I'm working on a project that does involve a scrollbar. What i do with the Rectangle class is i measure the handle of the scrollbar and use it for the bounds to drag it to. Like so: _maxScroll = _track.height - _handler.height; _bounds = new Rectangle( _handler.x, _handler.y, 0, _maxScroll ); And then in my function where i do the actual dragging, i do this: _handler.startDrag( false, _bounds ); If you look at the documentation for the Rectangle Class it also says this: The following methods and properties use Rectangle objects: * The bounds parameter for the startDrag() method of the Sprite class Hope this makes sense, to me it does :) Sid On May 28, 2008, at 5:33 PM, Helmut Granda wrote: to add to Sid's comments From the docs: *Note:* The Rectangle class does not define a rectangular Shape display object. To draw a rectangular Shape object onscreen, use thedrawRect() method of the Graphics class. ...Sid... could you elaborate on using the Rectangle class to measure objects on the stage? On Wed, May 28, 2008 at 10:15 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, For what do you want to use the Rectangle? Normally you would use it for instance to measure objects on the stage (at least i do ) For what you are doing cant you use a Shape? or a Sprite? Sid On May 28, 2008, at 5:10 PM, Matt S. wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle (0,0 ,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- ...helmut ___ 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] Rectangle doesnt have scaleX/Y?
yeah thats what I ended up doing. Thanks for passing on your post though :) .m On Wed, May 28, 2008 at 12:34 PM, Romuald Quantin [EMAIL PROTECTED] wrote: A rectangle is invisible, instead of using the scale properties that don't exist; maybe you can calculate the real width and height values? Or If your problem is keeping a ratio, maybe this post on my blog will help? http://www.soundstep.com/blog/2008/05/08/background-fitting-the-browser-and- image-ratio/ Romu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sidney de Koning Sent: 28 May 2008 16:48 To: Flash Coders List Subject: Re: [Flashcoders] Rectangle doesnt have scaleX/Y? Ofcourse :) Right now I'm working on a project that does involve a scrollbar. What i do with the Rectangle class is i measure the handle of the scrollbar and use it for the bounds to drag it to. Like so: _maxScroll = _track.height - _handler.height; _bounds = new Rectangle( _handler.x, _handler.y, 0, _maxScroll ); And then in my function where i do the actual dragging, i do this: _handler.startDrag( false, _bounds ); If you look at the documentation for the Rectangle Class it also says this: The following methods and properties use Rectangle objects: * The bounds parameter for the startDrag() method of the Sprite class Hope this makes sense, to me it does :) Sid On May 28, 2008, at 5:33 PM, Helmut Granda wrote: to add to Sid's comments From the docs: *Note:* The Rectangle class does not define a rectangular Shape display object. To draw a rectangular Shape object onscreen, use thedrawRect() method of the Graphics class. ...Sid... could you elaborate on using the Rectangle class to measure objects on the stage? On Wed, May 28, 2008 at 10:15 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, For what do you want to use the Rectangle? Normally you would use it for instance to measure objects on the stage (at least i do ) For what you are doing cant you use a Shape? or a Sprite? Sid On May 28, 2008, at 5:10 PM, Matt S. wrote: Hmm, that didnt help. It seems to be recognizing it as a number, and I can set the Width and Height of Rectangle, but when I try to set the scaleX and scaleY is when I get the error message. .m On Wed, May 28, 2008 at 10:56 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Matt, Try casting it to the XML data to a Number. Because XML data is a String. Like so: var rectangle:Rectangle = new Rectangle (0,0 ,Number([EMAIL PROTECTED]),Number([EMAIL PROTECTED])); Hope This helps. Sid On May 28, 2008, at 4:43 PM, Matt S. wrote: So I tried to the do the following: var rectangle:Rectangle = new Rectangle(0,0,[EMAIL PROTECTED],[EMAIL PROTECTED]); if(cS.height rectangle.height){ rectangle.height = cS.height; rectangle.scaleX = rectangle.scaleY; } But it gives me the following error: 1119: Access of possibly undefined property scaleY through a reference with static type flash.geom:Rectangle. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- ...helmut ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders