ScrollRect and how to know the real height

I am having a problem when I try to know the real height of the sprite.
I have a clas:
package
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.geom.Rectangle;
    import flash.system.Capabilities;
    import flash.utils.Timer;
    [SWF( width='800', height='600', frameRate='30', backgroundColor='#ffddee' )] 
    public class Test1 extends Sprite 
        private var timer:Timer;
        private var sprite:Sprite;
        public function Test1() 
            init(); 
        private function init():void 
            timer = new Timer( 2000, 0 );
            timer.addEventListener( TimerEvent.TIMER, onTimer );
            sprite = new Sprite();
            sprite.graphics.beginFill(0x00ffaa);
            sprite.graphics.drawRect(0,0,200,450);
            sprite.graphics.endFill();
            sprite.scrollRect = new Rectangle(0,0,200,200);
            addChild( sprite );
            show(0);
            timer.start();
            trace("START "+flash.system.Capabilities.version);
        private function show(cur_page:int  ):void
            trace("height = "+sprite.height);
            trace("scrollHeight = "+sprite.scrollRect.height);
            trace("boundsHeight = "+sprite.getBounds(sprite).height);
        private function onTimer( e:TimerEvent ):void
            show(0);
and it displays:
height = 450
scrollHeight = 200
boundsHeight = 450
START WIN 10,1,102,64
height = 200
scrollHeight = 200
boundsHeight = 200
Why  sprite.getBounds(sprite).height first time brings the real height, and  then the value by appropriate sprite.scrollRect.height, and how to fix  it?

I found the solution, which was published on 24th February 2009:
http://usecake.com/lab/find-the-height-and-width-of-a-sprite-with-a-scrollrect.html
* This function works like DisplayObject.getBounds(), except it will find the full
* bounds of any display object, even after its scrollRect has been set.
* @param displayObject - a display object that may have a scrollRect applied
* @return a rectangle describing the dimensions of the unmasked content
public function getFullBounds ( displayObject:DisplayObject ) :Rectangle
     var bounds:Rectangle, transform:Transform,
                         toGlobalMatrix:Matrix, currentMatrix:Matrix;
     transform = displayObject.transform;
     currentMatrix = transform.matrix;
     toGlobalMatrix = transform.concatenatedMatrix;
     toGlobalMatrix.invert();
     transform.matrix = toGlobalMatrix;
     bounds = transform.pixelBounds.clone();
     transform.matrix = currentMatrix;
     return bounds;
I  just want to make a sprite that can be scrolled using the scrollRect, for  this I need to know the scrollRect.height and full height of the sprite
The  solution I've found works, but I would like to know how to get the full  height of the sprite that has a scrollRect, using the native language  facilities.
Is this a bug, or am I doing something wrong?

Similar Messages

  • How to calculate the real height of the text in RichEditableText control?

    Hello,
    I created a new component by extending the RichEditableText control.
    When I try to get the value of contentHeight propery of this class even after compositionComplete event has fired, I get incorrect content height (so called "estimated" height). I was able to obtain the correct value only ater I set verticalScrollPosition to a value beyond this estimated content height thus causing the class to calculate real text height. Here is a code snippet.
    public class ViewerController extends RichEditableText
    public function loadText(){
       var tf:TextFlow = TextConverter.importToFlow(LONG_XML_FILE_WITHOUT_PICTURES_GOES_HERE as XML, TextConverter.TEXT_LAYOUT_FORMAT);
       //Events  
       tf.addEventListener(CompositionCompleteEvent.COMPOSITION_COMPLETE, compositionComplete);
       tf.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE, pictureLoaded);
       this.textFlow = tf;  
       this.verticalScrollPosition = 0;  
       this.textFlow.flowComposer.composeToPosition(); // I assume this makes the control calculate the real size of the text
    private function pictureLoaded(event:StatusChangeEvent):void {
    private function compositionComplete(event:CompositionCompleteEvent):void {     
    But what if I want to know the real height BEFORE I scroll to the very bottom of the text (or before even displaying this component)?

    SDN is not your code factory, please research yourself before posting, maybe ask whoever handed you this requirement?
    Thread locked.
    Thomas

  • HT3696 How to know if your mac is using the latest Haswell architecture processor or not? and how to know the difference between the new imac and the 2012/13 imac?

    How to know if your mac is using the latest Haswell architecture processor or not? and how to know the difference between the new imac and the 2012/13 imac?

    Sorry to reopen an old post, but I've just purchased a 2nd hand late-2013 iMac (or so thats what the seller said).
    I'm always sceptical though, and just wanted to know if there is a way to check if my iMac is indeed the late-2013 model that included Haswell?
    I've attached screenshots of the About This Mac section hoping it may help shed some light.
    Thank you in advance for your help!
    PS - I can't compare to the iMac specs link you posted above because its now showing the late-2014 models.
    <Image Edited by Host to Remove Serial Number>

  • What is SVN and how to know the details of SVN

    Hi Experts
    I want to know the complete details of SVN. please provide me the links to learn about this.
    Thanks in advance
    Prasannakumar

    Apache Subversion

  • How to know the dynamic values for this :AND category_id_query IN (1, :3, )

    Hi Team,
    R12 Instance :
    Oracle Installed Base Agent User Responsibility --> Item Instances -->
    Item Instance: Item Instances > View : Item Instance : xxxxx> Contracts : Item Instance : xxxxx> Service Contract: xxxxx>
    In the above page there are two table regions.
    Notes.
    -------------------------------------Table Region---------------------------
    Attachments
    -------------------------------------Table Region---------------------------
    --the attachments are shown using the query from the fnd_lobs and fnd_docs etc...
    I want to know what are the document types are displayed in this page ?
    --We developed a custom program to attach the attachments to the  services contracts and the above seeded OAF page displays those ..as needed.
    But after recent changes..the Attachments--> table region is not showing the attachments.
    I have verified the query..and could not find any clue in that..
    but i need some help if you guys can provide..
    SELECT *
    FROM
    *(SELECT d.DOCUMENT_ID,*
    d.DATATYPE_ID,
    d.DATATYPE_NAME,
    d.DESCRIPTION,
    DECODE(d.FILE_NAME, NULL,
    *(SELECT message_text*
    FROM fnd_new_messages
    WHERE message_name = 'FND_UNDEFINED'
    AND application_id = 0
    AND language_code  = userenv('LANG')
    *), d.FILE_NAME)FileName,*
    d.MEDIA_ID,
    d.CATEGORY_ID,
    d.DM_NODE,
    d.DM_FOLDER_PATH,
    d.DM_TYPE,
    d.DM_DOCUMENT_ID,
    d.DM_VERSION_NUMBER,
    ad.ATTACHED_DOCUMENT_ID,
    ad.ENTITY_NAME,
    ad.PK1_VALUE,
    ad.PK2_VALUE,
    ad.PK3_VALUE,
    ad.PK4_VALUE,
    ad.PK5_VALUE,
    d.usage_type,
    d.security_type,
    d.security_id,
    ad.category_id attachment_catgeory_id,
    ad.status,
    d.storage_type,
    d.image_type,
    d.START_DATE_ACTIVE,
    d.END_DATE_ACTIVE,
    d.REQUEST_ID,
    d.PROGRAM_APPLICATION_ID,
    d.PROGRAM_ID,
    d.category_description,
    d.publish_flag,
    DECODE(ad.category_id, NULL, d.category_id, ad.category_id) category_id_query,
    d.URL,
    d.TITLE
    FROM FND_DOCUMENTS_VL d,
    FND_ATTACHED_DOCUMENTS ad
    WHERE d.DOCUMENT_ID = ad.DOCUMENT_ID
    *) QRSLT*
    WHERE ((entity_name    ='OKC_K_HEADERS_V'-- :1
    AND pk1_value          IN ( 600144,599046) --:2
    AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    AND datatype_id       IN (6,2,1,5)
    AND (SECURITY_TYPE     =4
    OR PUBLISH_FLAG        ='Y')))
    --='000180931' -- 'ADP118'
    The above seeded query is the one which is used for table region to retrieve the data..
    how to know the dynamic values for this : AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    --Sridhar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Patricia,
    is it working for restricted key figure and calculated key figure ??
    Note Number Fisc Period Opening Days
    1 1 2
    2 1 3
    3 1 0
    because I have other restriction, so I create two restricted key figure..
    RK1  with restriction :  Total Number of Note,
    RK2  with restriction :  Total Opening Days ,
    then I Created a calculated key figure, average opening days in a period
    CK1 = RK2 / RK1..
    in this case, I am not sure if it will work or not..
    for example, during RK2 calclation, it might be this   2+3 = 5, the line with 0 will be ignored..
    during RK1 calcualtion, it might be 1 + 1 + 1 = 3. ---> Not sure in this case, the line with opening days 0 will be calculated or not..
    could you please confirm..

  • How to know the balance and validity of internet data in iPad

    How to know the balance and validity of internet data in iPad?

    Sir I m using internet in ipad4 with airtel network
    They provide me 2gb data with the amount of 255 rupees
    And now I inserted the sim in my ipad4
    And start the surfing on safari n all
    And now I wanted to know how much data is balance.

  • I no longer have access to my icloud email and don't know the answers to my security questions. Does anyone know how to work around this to reset my icloud ID without losing my info? I haven't backed up in a year because of this.

    I no longer have access to my icloud email and don't know the answers to my security questions. Does anyone know how to work around this to reset my icloud ID without losing my info? I haven't backed up in a year because of this.

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (123381)

  • HT204088 How to know the rest of money in a credit card and the total of purchase amount?

    How to know the rest of money in a credit card and the total of purchase amount?

    What do you mean 'the rest of money in a credit card' ? All you can see on your purchase history is what you've bought, you can't see how things were billed nor the total amount that you've spent in the store - you will need to sum your purchases yourself to see the total.

  • How to know the amount of ora 11g page-out  memory (sga and pga)?

    How to know the amount of oracle 11g page-out memory ( sga and pga) in the SunSolaris 10 Unix and Linux.
    I need to know how many oracle memory are being page-out ( all and for a one oracle server process).
    thanks

    You can monitor the paging with vmstat or sar commands.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b32009/tuning.htm#sthref500
    You can also get the paging information on OEM home page if configured for your database.
    But I don't know if there exists a method with which one can find out how much memory per session/server process is getting paged out.

  • I just purchased a secondhand iPad in carboot and I didn't realised that the old account is still linked to the device now can't  activate my accnt.i don't know where  and how to contact the original owner.what should I do?is there any other option?

    I just purchased a second hand iPad in carboot.i didn't realised that the old accnt is still linked to the device,now I icant activate my account .I don't  know where and how to contact the original owner.what should I do activate my accnt?is there any other option?

    Apple cannot help you locate the original owner. If you have no way to contact him/her, and you purchased directly from the seller rather than through a site that offers buyer protection, then the iPad is useless to you and you have wasted your money. The iPad is quite probably stolen and you should turn it in to the police.
    This is why it's very risky and usually unwise to purchase out of a car boot from someone you don't know.
    Regards.

  • How to know the User name and date, who executed the report last time.

    Hi All,
    We are collecting a list of reports which are not executed for past 3 months. Can anybody tell me how to know the username and date they executed the report last time.
    Is there any table to look ? or is there any process ?
    Thanks,
    Ravi.

    Ravi,
    Use SE16 - then look at rszcompdir.
    We look up Version = 13 for queries.
    Regards
    Gill

  • HT201210 I have an old i phone 3G and do not know the password for it. trying to restore it from itunes but keep getting error code 1015, any help on how to get passed this please?

    I have an old i phone 3G and do not know the password for it. trying to restore it from itunes so my daughter can use it as an ipod but keep getting error code 1015, any help on how to get passed this please?

    Hi ratcat14!
    I have an article that can help you troubleshoot this issue:
    Resolve specific iTunes update and restore errors
    http://support.apple.com/kb/ts3694
    Check for hardware issues
    Try to restore your iOS device two more times while connected with a cable, computer, and network you know are good. Also, confirm your security software and settings are allowing communication between your device and update servers. If you still see the alert when you update or restore, contact Apple support.
    Common errors: 1, 10-47, 1002, 1011, 1012, 1014, 1000-1020.
    Thanks for being a part of the Apple Support Communities!
    Cheers,
    Braden

  • TS4291 I can't send mail from my iPad apps, I just get the error message, 'The recipient- was rejected by the server because it does not allow relaying.' Does anyone know what this means and how to fix the problem.

    I can't send mail from my iPad apps, I just get the error message, 'The recipient… was rejected by the server because it does not allow relaying.' Does anyone know what this means and how to fix the problem.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Using a POP account with multiple devices
    http://support.apple.com/kb/ht3228
    iOS: Adding an email account
    http://support.apple.com/kb/HT4810
    iOS: Setting up an Outlook.com, Hotmail, Live, or MSN email account
    http://support.apple.com/kb/ht1694
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    How to Sync Contacts with Your iPad Using iTunes
    http://www.dummies.com/how-to/content/how-to-sync-contacts-with-your-ipad-using- itunes.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    eMail Groups - You can use a third party app that many users recommend.
    MailShot -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    Group Email  -  https://itunes.apple.com/us/app/group-email!-mail-client-attachments/id380690305 ?mt=8
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • How to know the process chain start time and end time

    Hi Experts,
                   How to know the process chain start time  and end time .
    Thanks in advance
    Regards
    Gutti
    Edited by: guttireddy on Feb 23, 2012 11:30 PM

    Hi Reddy,
    You may find the run time of a PC using below steps.
    1. Call SE38 > /SSA/BWT > Execute  > Enter your PC , choose the date and time > Execute. Here Run-time of a PC is displayed. (or)
    2. Call RSPC1 > Enter your PC > Execute > Goto Log view > Right click on the start Variant > Displaying Messages > Note down the start time in Chain Tab. Now Right click on the last Process type of the PC > Displaying Messages > Note down the End time in Chain Tab. The Difference b/w start time and end time gives the Run-time of your PC.
    Hope this helps.
    Regards
    Sai

  • How to know the model of my Dv6 and how to install switchable graphics driver

    hi,
    I have a HP pavilion dv6 but I don't know what model is to download the drivers.
    Here are the specs:
    (this was purchase in Europe Portugal)
    - Intel core I5 M480 2.67Ghz
    - 500GB HDD 5600rpm
    - HD 6650
    - 4GB RAM
    - Finger print reader
    - 3x USB
    -Dvd Rom
    - x1 SD CARD reader
    - x1 esata
    - x1 HDMI
    - x1 Vga port
    - Camera HP trueVision
    - Dobly Advance Audio ALTEC lansing
    - Win7 Home Prem 64bit
    I need to install the AMD 6650 Driver with the switchable drivers options currently it only detects the Intel HD Graphics, installing the latest driver from AMD for the mobil 6650 will not work it doesn't dettect the graphics card.
    How can I know my laptop model ? and how to install the switchable and AMD drivers.. the laptop came with no CDs.
    Thank you,
    Arthur

    Get your full Model number or Product number from the Service Tag attached to bottom of laptop (may be under battery)
    How Do I Find My Model Number or Product Number
     Once you have the info, use the button at top of this page titled "Support", then click "Download drivers" from the menu. Enter your Product Number. After entering PN click 'Go". On the next page use the dropdown menu to select your Operating System, click Next. A list will populate with drivers/software.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

Maybe you are looking for