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
>>>>> [email protected]
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> [email protected]
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>
>>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
>
> -- 
> ...helmut
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to