Why is code to get center of image not working?

Hey there. I have am trying to establish the center of the imags that load so that I can put them in the center of the stage. I am doing this as each image is a different size.
Here is the code i have gotten to work before but its not working now and I have been searching to find what I have done wrong with no luck. : (
Would you look it over and maybe you will see what I am doing wrong?
public function placePicture(e:Event = null):void {
     rawImage = imageData.image[imgNum].imageURL;
     lastImageIndex = imageData.*.length() - 1;
     imageLoader = new Loader;
     imageHolder = new Sprite;
     imageLoader.load(new URLRequest(rawImage));
     imageLoader.x -= imageLoader.width/2; //this should set the image to the center no?
     imageLoader.y -= imageLoader.height/2;
     imageHolder.x = 640; //this is the center of the stage
     imageHolder.y = 100;
     imageHolder.addChild(imageLoader);
     masterHolder.addChild(imageHolder);    
The result when I publish is the picture comes on stage but the top left corner goes to 640 instead of the center of the image going to 640.
I tried several variations of this all with the same result:
imageLoader.x = -1*imageLoader.width/2;
I tried using setRegistrationPoint with the following tutorial: http://flashscript.ca/set-registration-as3.php
and I tried doing all of the above by inserting the loader into a sprite and then applying the code to the sprite and then adding that sprite to another sprite and putting that at 640 and not inserting it in another sprite and trying to straight up put the existing sprite at 640 (hopefully that all makes sense). And I have tried to put it to width/3 and nothing different happens.
If you have any other ideas or can see what I am doing wrong I would really be gratefull for some tips! : )
Thanks for any help!
oh, and I am getting no errors on this.

the image's width and height are not available until loading is complete.  ie, use a complete listener/listener function.

Similar Messages

  • Why PhotoBooth can't get the background images to work properly on the picture

    Why PhotoBooth can get the background images to work properly on the picture, is it because too much luminosity in the environment or too little? I have tried everything and nothing works.
    <Re-Titled By Host>

    Might try this...
    Go to System Preferences > Universal Access and down in the Display: section make sure that the Enhance contrast: slider is all the way to left to Normal, or more to the right for less Contrast.
    Go to System Preferences > Accessibility in 10.8.x,and down in the Display: section make sure that the Enhance contrast: slider is all the way to left to Normal, or more to the right for less Contrast.

  • When using Lightroom Book module for Blurb book making, why do I keep getting a low image quality message if it's supposedly accessing my large raw files in my library?

    When using Lightroom Book module for Blurb book making, why do I keep getting a low image quality message if it's supposedly accessing my large raw files in my library?

    I think I've solved my problem with a Google Search. I came across a free slide show generator
    (contributions requested) that shows much higher quality slide shows than either iPhoto or Aperture 3.
    You click on a folder of jpegs and it almost immediately generates thumbnails and within a few seconds
    I can be viewing a full screen, tack sharp, slideshow of all of the files in the folder. Much sharper than
    I'm used to seeing.
    I think I'll keep the Aperture 3 and use if for the purpose it's intended for in the future. I'll also redo the
    image preview files to the small size it started with and then I'll copy all of the files I'm interested in from
    iPhoto into a separate folder on another disk. I'll use Aperture to catalog and to perform image manipulations
    on but I won't try to use it as an iPhoto replacement. I don't think I'll be using iPhoto much as an image
    viewer in the future either after I finish moving my favorite pictures to the Phoenix Slides folder.
    The name of the free program is Phoenix Slides. It's free to download and try, free to keep (though I
    think you'd want to pay the small amount requested) and fast. My pictures have never looked so good
    before.
    http://blyt.net/phxslides/
    Message was edited by: Jimbo2001

  • My securety code on my debit card is not working and I need to know why?

    my securety code on my debit card is not working and I need to know why?

    You need to contact iTunes support. We are users here just like you and would have no idea why it isn't working. At the bottom of the iTunes Store page in iTunes there is a contact link.

  • Why do I keep getting, this mp4 "was not copied to your ipod because it cannot be played on this ipod"?

    Why do I keep getting, this mp4 "was not copied to your ipod because it cannot be played on this ipod"?

    See:
    iTunes: Frequently asked questions about viewing and syncing videos
    iTunes: May be unable to transfer videos to iPhone, iPad, or iPod

  • Why do I keep getting the message "key not valid for use in specified state"?

    why do I keep getting the message "key not valid for use in specified state"?

    You need to deal with Adobe Customer support.  This is a  Photoshop User forum the is also one for LR may be some on over there has encountered you problem Photoshop Lightroom

  • Why can't I get open type features to work properly with an open type font on InDesign CS5.5?

    I installed a very complete set of styles of an opentype font with Font Book – Mac OS X 10.9.4 – but when I tried to format a sample text on InDesign CS5.5 I noticed that I could not use the opentype features on the Open Type menu as I usually do.
    Could anyone help me, please?

    It's ffScala Sans, but has separate files for small caps, figures, etc.
    I was trying to use small caps, lining figures and superscripts when I
    noticed none of the OT features are available.
    2014-07-30 21:56 GMT+01:00 Miguel Sousa <[email protected]>:
        Why can't I get open type features to work properly with an open type
    font on InDesign CS5.5?  created by Miguel Sousa
    <https://forums.adobe.com/people/MiguelSousa> in Adobe Type - View the
    full discussion <https://forums.adobe.com/message/6598614#6598614>

  • HT201317 Why do I keep getting applePhotoStream.exe has stopped working

    Why di i keep getting applephotostream.exe has stopped working on my PC. I have removed the icloud control panel and reloaded it many times and whilst it cures the problem temporarrily it soon comes back................any permanent cures please!

    The only worked it worked for me was to uninstall icloud, restart my pc and reinstall (download from apple site) icloud.

  • Substitution written under cost center accounting is not working for tcode MB1B but working for MIGO_GI

    Hi All
    Do you know why this behaviour different for subtitution written under cost center accounting.
    We have written substitution using coding block table. Logic of substitution is in case of any GL maintained in a set is being used for posting , then we will replace the cost center with profit center vlaue. Reason being we have same naming convention for Cost center and Profit center.
    Thanks
    Sonia

    Hi,
    MB1B is t-code for stock transfer posting.
    Stock transfer posting generate FI document using balance sheet account, not P&L account.
    Because you don’t create cost elements using balance sheet accounts related to stock, I think that Substitution written under cost center accounting is not working for tcode MB1B is right.

  • Why copy option from recent call numbers is not working on ios7 [recent call logs in phone]?

    why copy option from recent call numbers is not working on ios7 [recent call logs in phone]?

    Here is a copy of my expressions and a copy of my data. The expressions match up going from left to right
    Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4"))
    sum(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4")))
    count(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4")))
    PUBLIC SHARED FUNCTION CalcPTD2(LookupArray AS OBJECT) AS INTEGER
         DIM i,Total AS INTEGER
         Total = 0
         FOR i = 0 to UBOUND(LookupArray)
               Total = Total + CINT(LookupArray(i))
         NEXT i
     NumberTimes  =   NumberTimes +1
    RETURN  Total
    END FUNCTION

  • Why is my iPhone 5c's home button not working at all it didn't work once for a few minutes then it was normal again now it won't work at all. HELP

    Why is my iPhone 5c's home button not working at all it didn't work once for a few minutes then it was normal again now it won't work at all. HELP

    The screen repair was botched. Take iPhone back to place of screen repair, and have them get the home button working again.

  • Why do some keys on my IPhone 4S not work in the vertical position?

    Why do some keys on my Iphone 4S not work in the vertical position?

        Let's get to the bottom of this issue mike4820! What specific keys are not working properly while in vertical position? This is more likely the result of some display settings or an application installed on your phone. Please ensure that you have the latest iOS version installed (7.1).
    AntonioC_VZW
    Follow us on Twitter at www.twitter.com/VZWSupport

  • When I navigate web with Firefox my Thinkpad trackpoint center button is not working. With other web browsers it works well. Where is the problem in firefox, how to enable TrackPoint center button?

    When I navigate web with Firefox my Thinkpad trackpoint center button is not working. With other web browsers it works well. Where is the problem in firefox, how to enable TrackPoint center button?

    I have exactly the same settings in Options (in both computers)
    for history, these 2 add-ons and all other stuff in Options. The only difference is that on 1 pc sessions can be saved and closed tabs can be reopened, on other main pc they stopped to work. + no any other add-on that does similar things works on this pc.
    It is also interesting that I can reopen closed visited sites from History Panel, but not by pressing the Button. For now I only manually bookmark links to a temporary folder.
    Recently (some 2 month ago) I pressed x and Firefox closed all tabs without saving them without displaying save & quit pop up.
    so I changed 4 settings in about.config
    browser.tabs.warn on close true
    browser.warn on quit true
    browser.warn on restart true
    browser.show.quit warning true
    but the problem with sessions appeared only 1 week ago.
    So I guess the problem is not with the History settings or other settings. Seems that something responsible for button or for storing info about tabs/sessions got corrupted. :(

  • Why isn't my back button in Safari not working? I am constantly resetting Safari.

    Why isn't my back button in Safari not working? I am constantly resetting Safari.

    Cheryl...
    Go to ~/Library/Caches/com.apple.Safari
    Move the Cache.db (or ApplicationCache.db) file from the com.apple. Safari folder to the Trash.
    Restart your Mac. Launch Safari. Try the back button.
    ~ (Tilde) character represents the Home folder.

  • Any ideas why the video camera on my imac is not working?

    Does any one have any idea why the video camera on my imac is not working? I have been using skype on my imac for some time and recently I have discovered that it wont work, could this have anything to do with the mountain lion upgrade?

    Have a look here: http://support.apple.com/kb/HT2090?viewlocale=en_US
    I think I'd start with the SMC reset.

Maybe you are looking for

  • User accounts, directory structures and selective access privileges

    Bought a new MacBook Pro back in April and only now am I getting down to using it. I was thinking of creating the following user accounts in the hope of creating a scheme that allows selective access to certain folders: Root -a super user account Adm

  • Photoshop elements 11 and premiere elements 11 upgrade to version 13

    Just bought an ugrade to version 13 for my photoshop elements11 and premiere elements 11. What I did not know or did have to know is that version 13 is not compatible with Windows Vista (stupid me). Is it possible to cancel my upgrade?

  • Restoring from time machine after a clean reinstall

    Hi, I just came back from the Apple store where the Genius Bar did a full reinstall of Snow Leopard to repair an issue with my computer. The techs weren't sure if the issue I was experiencing (freezing of the keyboard and touchpad) was because of har

  • IE Issue - Login button does nothing when accessing at secure URL

    I have a user login screen for a customer control panel located at www.realestate-websites.com that does nothing when you click on the login button when using IE on SOME computers. Symptoms: The computers that are having the problem get it every time

  • Why does Scheduling Agreements create multiple deliveries?

    Hello SAP Experts, We are on 4.7c.  Our scheduling agreements automatically create deliveries; and I was wondering why instead of putting the scheduled lines onto one delivery, it automatically creates multiple deliveries for the scheduling agreement