How to calculate width of imported image

I use the code below to layout 12 imported images. The code works fine as long as the images have a consistent width. However, the widths have now changed and my layout is screwed up. To solve the problem I'd like to change my layout formula to place images according to thier widths. However, my problem is that I cannot access the widths of the imported images. So my question is: How can I calculate the width of each imported image?
      for(var i:int=0; i<12;i++){
           imageLoader = new Loader();
           var url:String = "images/animal"+i+".png";
           var urlReq:URLRequest = new URLRequest(url);
           var sprite:Sprite=new Sprite;
           imageLoader.load(urlReq);
           imageLoader.x=70*i
           imageLoader.y=100
           sprite.addChild(imageLoader)
           addChild(sprite);

Thanks. That makes sense. What type of event do I need for my event handler? If I use:
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,  imageLoaded);  
Should I have:
public function imageLoaded(e:Event):void {
   trace("Width="+e.contentLoaderInfo.??)

Similar Messages

  • How to check width of loaded image

    Hi my script loads an image like this:
            image = new Sprite();
            imageLoader = new Loader;
            imageLoader.load(new URLRequest(imageList.image[1].imgURL));
            image.addChildAt(imageLoader, 0);
    how can i check the width of loaded image? trace(image.width) gives 0...

    You need to wait until the image is loaded before you can try to ffind its width.  To do that you need to use the contentLoaderInfo property of the Loader class
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, manageImage);
    The manageImage event handler function is where you can check things since it is triggered after the object is loaded.

  • Hi Everyone. I am new here. Please guide me how to open an alredy imported image in LR

    I am a Beginner in LR pls guide .How do I open an already imported photo in LR??

    I think everything you need to know can be found here: Learn Lightroom 5 | Adobe TV
    but very briefly:
    the Library grid view screen (press G) shows you a controllably selective view from your entire image library, which consists of all the pictures you have ever imported (except for unwanted ones that you have since deliberately got rid of). The selectivity happens down the left side panels here, also via a Filter bar at the top, though that can follow later.
    When you import some new photos, by default LR switches to a selective view showing only the pictures of that batch. Though that behaviour can be changed, it does not really signify because one is constantly switching to different selections ANYWAY in LR, depending on what you want to do from moment to moment, Just as, how one uses a file browser to constantly open up different windows onto the computer storage.
    The image selection visible in the main Library window also appears in the Filmstrip at the bottom of the screen, across all the various modules.
    A view of potentially tens of thousands of photos (eventually) all at the same time in one list, would not be very manageable. But to reassure yourself that they are there, you can click in the left side of Library, Catalog pane, "All Photographs". There are various means of narrowing down from there, and "Last Imported" is one of those.
    The Collections panel is for the various other setups one may use to do that, either built-in or user created, which are not necessarily based on the storage location of the images.
    Clicking in the Folders panel gives you a sub-view of the just the images which are stored in a particular physical drive and folder - or if "include subfolders" is checked, in the whole region of the file system, of which the selected folder is the parent.
    There are sorting options in the Toolbar below the Library "grid" - press "T" if this is not showing - and many people find it simplest to set that to "Capture Time" in order to put and keep the photos in shooting sequence, normally.
    RP

  • How can I make an imported image smaller without changing the size of the canvas?

    After downloading some free icons, I used the drag and drop method to bring the icon of my choosing onto a blank canvas that is 313x188 pixels. The image is larger than I need it to be, so I need to make the image smaller while keeping the canvas size at 313x188 pixels. I've tried several things after googling it, but have not had any luck. Help; I'm still learning! Thanks in advance!

    ctrl/cmd-T will bring up transform. Then just drag the handles to size it - hold the shift key to constrain the aspect ratio.

  • How to animate imported images?

    Hi, I'm new to Premiere. I've imported a PSD file with full alpha transparency. It shows a mobile phone being held, as if from a first-person perspective and is being used in a scene that is filmed in first-person.
    On the phone, I want the screen's image to change, perhaps at certain specified keyframes. I know for an animated image I could import a GIF, but that format does not support alpha.
    In short, how can I make an imported image - that's used in Video 2 on top of Video 1 - change itself to an image of the exact same resolution at specified times?

    Change the image on the phone in Photoshop instead. Ohotoshop Extended has a timeline, or you could just import multiple copies of the phone image into Premiere Pro and use them as you need them.

  • How to add metadata on import

    I can not for the life of me figure out how to add keywords on importing images. I have scoured the net looking for answers and cant find anything. I see the "Add Metadata from", but there is nothing underneath it where you can add information. The tutorial video from Apple shows fields underneath where you can add information, but I cant figure out how to get that to show up. This is driving me craaaazzzyy!! Any help sure would be appreciated!

    I'm having the same issue as the image in the previous post. Anyone else have this too or a fix?
    I am running 10.5.4 and the most recent version of Aperture w/ all updates
    I have read thru the suggestions and deleted the plist files with no fix.
    I also re-installed and the issue remains. The machine I am installing it on was just recently formatted and re-installed.
    This is very confusing, looking forward to any help or suggestions.
    Thanks,
    Ian

  • Needed help in: how to import image in InDesign Server using Java Code

    New to InDesign Server.
    I am not been able to import image to document.
    I tried to import image using the sample snippets "PlaceTextFileInFrame.java".
    modified the line:
    String placefilepath = "C:\\placeFile.txt";
    to
    String placefilepath = "C:\\Image.jpg";
    myTextFrame.place(placefilepath);
    Is this the correct way to import image or there is another solution.
    1.The image gets imported but i am getting blur image(Zoomed image).
    2.The image gets imported to its original image width & height.
    3.I need to know how to set the image width & size.

    My Requirement is-- I ve to connect to msn search page in order retrieve the result set from msn search. The same code which I do pasted below is working for GOOGLE n YAHOO with minor changes.But not for MSN.., Can any one help me.
    I've pasted the code for msn..,
    import java.io.*;
    import java.net.*;
    public class File {
    public static void main(String[] args) throws IOException {
    Socket s = new Socket("search.live.com", 80);
    String query = "java";
    PrintStream p = new PrintStream(s.getOutputStream());
    p.print("GET /results.aspx?q=" + query);
    p.print("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n");
    p.print("Connection: close\r\n\r\n");
    InputStreamReader in = new InputStreamReader(s.getInputStream());
    BufferedReader buffer = new BufferedReader(in);
    String line;
    while ((line = buffer.readLine()) != null) {
    System.out.println(line);
    Edited by: Lijo_Java on Jul 13, 2008 9:03 PM

  • HELP: How do I use iPhoto 08 to import images onto my iPhone 3G?

    Hi,
    I was wondering how best to import images into my iPhone 3G for viewing.
    Most of my image files are large high quality 2 -4 MB files.
    Is there an easy way to downsize the files for viewing on the iPhone 3G? Does iPhoto have a setting specific for import/export use with the iPhone?
    How do I set a specific photo as the phone's wallpaper and does it have to be specifically sized to use as wallpaper?
    I have read the iPhone 3G manual but it was less than helpful just saying "Use iPhoto to import photos onto your iPhone"...

    here is a thread with lots of discussion of this topic - http://discussions.apple.com/thread.jspa?threadID=1618079&tstart=105
    In general you make album(s) of the photos you want on the iPhone and sync the album(s)
    LN

  • Is there any way to get the height/width of an image before importing it in the indesign document.

    Hi All,
    I need to obtain an image's attributes such as dimensions (height, width in pixels) without placing image in indesign document.
    I have full path of the image (say abc.jpg is stored at c:\my pic\abc.jpg).
    I have obtained the IDFile for this image, tried getting size using GetFileSize() which correctly return size in bytes.
    Is there any way to get the height/width of image without importing it in the indesign document.
    Please, give me some hints. I have spent quite a lot time digging in CHM. I have searched in FileUtils, IDFile API's but found no method which serves this purpose.
    At this point I am clueless where to search next.
    Any help will be appriciated.
    Just a point to mention, I am able to get image height and width for an image in indesign doc though Its not my requirement.
    Thnx,
    D.

    You might be able to examine the contents of the PlaceGun after calling kImportAndLoadPlaceGunCmdBoss without actually placing the image in a document. Not sure, but would be worth looking at.
    Otherwise you will probably have to write platform specific code, ideally with a generic platform-independant wrapper (see SDKSamples/paneltreeview/PlatformFileSystemIterator).
    For the Mac, look at CGImageGetWidth() etc., not sure what the best option is for windows.
    Perhaps Quicktime could provide you with a platform independant solution.

  • How do I import images from my hard drive without losing resolution? My original files after import are significantly smaller. What should I do?

    How do I import images from my hard drive without losing resolution? My original files after import are significantly smaller. What should I do?

    Hi Keith, and all others chiming in, I do have the correct option checked in advanced settings telling iPhoto to copy the images into the library. What is a refernced library? Perhaps this is where I am getting confused. I exported my entire photo library from an old iMac5 to my external hard drive, from there I attempted to import the entire library to my new iMac. Am I overlooking an obvious and easy way to import from the hard drive to the new iMac--I dragged the entire photo pholder from the hard drive to the open window of iPhoto on the new computer. Now, I only get preview file sizes in iPhoto, unless I have my external drive open. Perhaps I need to import the original images from the hard drive in a different way...?! (This is making me feel pretty stupid.)

  • How to import images in iPhoto?

    I use iPhoto importing images from this same computer and from iPhone with iCloud. A problem I've always suffered also before buying iPhone was that I can't import images in iPhoto.
    Well, I can drag an image from, for example, the desktop, but if I delete that file on the desktop I won't be able to open that image in iPhoto, even if I've imported it. This is because of I don't know a way to "consolidate the library" in iPhoto (while I usually do it in iTunes), so iPhoto just manages my images, but it doesn't really import them.
    When, in iPhoto, I import a photo shooted with iPhone and showed in Photo Stream, that photo is really copied in the library, so in the computer, and I can delete the photo source, in fact if I delete that photo from Photo Stream that photo will remain however in iPhoto, and if I click on the high menu bar (FIle, Show Original ), a Finder window of the folder in which there is the copied photo will be opened. That finder is "hidden" in the stuff of the iPhoto Library (in Images folder of Mac), but it's not simply to go and find any photo in this way (folders and subfolders named with long numbers).
    So can I choose what way to use? The good of that second method is that iPhoto manage directly and really its photos because it "has" them, but the bad is the almost impossible way to find photos in that organization library (waster than iTunes media folder, that is clear). The good of the first method is that no automatic copies will be created because iPhoto just manage photos which remain in my folders, but the bad is that iPhoto doesn't manage them direclty, but depending on my folders and my files wherever and however they are, and I can't edit them because I would change the file that is used in iPhoto with an other different version.
    I think this is an annoying problem because there is a file with photos (i.e. the iPhoto Library) that contains copies of photos occuping memory while I don't know this is happening, because that copy is not announced, and simultaneously I have those photos of iPhoto free to be changed and removed with the risk of disappearing from the photos of the program.

    I can drag an image from, for example, the desktop, but if I delete that file on the desktop I won't be able to open that image in iPhoto, even if I've imported it
    That's an indication that you may have your library set up as a referenced library:
    Check the Advanced preferences in iPhoto to see if that checkbox is selected or not.  If it isn't checkec, check it and try importing agan. 
    To make sure all Photo Stream photos are automatically imported into your library set up iPhoto's PS preferences like this:
    You should read this User Tip by Terence Devlin which is the best treatise on how to access photos (for use outside of iPhoto):  How to Access Files in iPhoto
    OT

  • HT4101 The SD card reader won't import images to the iPad. I purchase 10 months ago, and haven't had a problem with it until today. How do I remedy this problem? I'm about the go out of town and prefer not a travel with my laptop.

    My SD card reader won't import images from the SD card. I purchased this product 10 months ago and have had no problem with it up to now. How do I remedy this problem. Using the product allows me to travel without a laptop ...Please help!

    Have you tried to give your device a reset? Sometimes that helps with glitches. Hold down the sleep and home keys, past when you see the red power down slider and until you see the silver apple. Let it reboot and try again.
    ALso, the card reader will only see files that are formatted correctly. If you just took the images from your computer and put them onto the card, then it won't work. They have to follow a strict naming convention. There has to be a folder named DCIM on the card and then all those images have to have a file name of exactly 8 characters, DSC_3857 for example. Your camera makes this naming structure but if you manually put the photos on that card you may not have replicated it.
    Is this a card you've used before? If it's a new card and is empty then the iPad won't read it. Also if it's SDXC it won't read those either (XC cards use a file structure that the iPad can't decipher)

  • How to import images in alphabetical order???

    How may I import images in alphabetical order? I have a stack of images that I have renamed so that they are in alphabetical order. However, when I import these ~100 images into iPhoto, it sorts them in some other order (perhaps, although I am not sure, by time taken). If iPhoto does not allow one to import alphabetically (although I sure hope it does, since this would be very convenient), any ideas how I may modify the image taken time so that I can get this set imported in the order that I need?
    Thank you very much!
    iPhoto 5.04
    OS 10.4.10

    What print service are you using? Is it an online print service? Or an iPhoto plug-in? To upload to a website you should export the photos (a Desktop folder is convenient) and choose the exports for the upload.
    If you are using the Finder to see a list of files, the Finder always lists them in alpha-numeric order. To get a list of photos to export to your Desktop (for uploading) and preserve your order, try this: create an Album, sort them the way you want, then Export to a Desktop folder. In the Export dialog, choose "use Album name" as the filename option. This will preserve your order upon export and name the files "Album name - 01.jpg, Album name - 02.jpg, ..., Album name - 99.jpg." It only works with 99 or fewer photos in the album, so for more photos create another album.

  • How to import images in Application

    I know how to import images in Applet. Can anybody give me small example of how to import images in Application?

    import is a bad word to use in this context
    it's better to say 'how to load an image' i guess
    at any rate, there are 50 million articles, postings, samples, etc. that deal with loading images in Java
    search google

  • How can I import images from iphoto with the albums and folders?

    How can I import images from iphoto without losing the albums and folders I already created?

    In Organizer, you can choose File>get Photos and Videos>From iPhoto.
    Importing from iPhoto'09: If in iPhoto, you organize your media using photo references, that is, the media actually does not reside inside iPhoto library package, and are referenced through original locations, Organizer does not create new copies of those media and just refer to the original location. but if your iPhoto media reside inside iPhoto library, Organizer creates a copy all media in your pictures folder, also imports albums and tags and other metadata.
    Importing from iPhoto'011: In this case, Organizer always creates a copy of your photos in your pictures folder which resides inside iPohto package. It does not import the albums and other metadata like star rating, caption etc.
    Hope this information helps!
    regards,
    vaishali

Maybe you are looking for

  • New moto e 2nd gen problem with contact list,. all email in my contacts

    Please help. I just switched phones to the new Moto E 2nd gen AT&T from virgin mobile.  My contacts are over 1500, it grabbed in to my contact list any email contact i ever received or sent. I only want phone numbers my contacts. I tried deleting the

  • Numbers not displaying certain text.

    I use Numbers to create invoices. Previous versions of numbers would display and print but not export certain text. In version 9 the same text will not even display. Any way to fix without opening all my old invoices in a previous version of Numbers?

  • Problem calling PL/SQL procedure from Workflow function activity.

    Hi, I am trying to call a PL/SQL procedure from within my workflow activity. While I am able to execute the procedure through SQLDeveloper, the workflow function does not seem to call it. It seems that custom PL/SQL procedures have to conform to cert

  • Websphere error in ear application starting

    Hi all, I am a newbie into this J2EE world. So please excuse me if my questions sounds too naive. I am trying to install an ear application into Websphere server on Sun solaris platform. The application is packaged with 4 war modules & one EJB module

  • How to launch Photoshop CS5 in either 32 bit or 64 bit mode

    Some of my plugins - (notibly Nik Viveza & Silver Effects Pro) only run in 32bit mode at present.   I would rather work in 64bit (I think - hard to tell if I'm getting any real benefit - will have to try some benchmarks)  I work with large files 100m