Scaled images within a HBox

My goal is to create a list containing image thumbnails side by side. The images are created dynamically as is the list.
private function createThumbsList(imageUrls : Array) : void {
    var list : HBox = new HBox();
    list.height = 50;
    this.moduleContext.displayContainer.addChild(list);
    for (var i : Number = 0; i < imageUrls.length; i++)
        var img : Image = new Image();
        img.source = imageUrls[i];
        img.percentHeight = 100;
        img.addEventListener(MouseEvent.CLICK, function(event : MouseEvent) : void {
            // show fullsize image
        list.addChild(img);
The thumbnails are scaled to the height of the list. Although the images' content width is scaled too, their control width remains unscaled. Thus there are heavy spaces between the thumbnails.
How to solve?
I learned there are properties "width" and "contentWidth" and you only have to do:
    img.width = img.contentWidth;
But nothing happened when I added this after list.addChild(img);. I guess it's too early in the control's life cycle and "contentWidth" is not calculated yet, right? When is the right moment for the command? Or is there a workaround, e.g. usage of another container control instead of HBox?
Thanks,
Steffen

hi,
If you use a loader  image.load() then you can calculate the aspect and set the width correctly in the load complete event. I don't have time at the moment to look at an mx based solution but the following example allows you to load images but the renderer calculates the width based on the list height.
http://gumbo.flashhub.net/pagedrop/  source included.
David

Similar Messages

  • How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    I think others would be able to help if you describe a little more why you'd like to do this. Given that drop zones are a way of passing images into Motion that you want to manipulate, resizing a drop zone is the equivalent of resizing the image.
    If you're having a problem with an image from Final Cut being too big or too small, select the Drop Zone in the inspector and make sure the Fit parameter is set to 'Fit' - 'Center' will result in images dropped not being scaled to fit the Drop Zone. 'Stretch' will force the dropped image to fill the space defined by the drop zone,
    If the image is already cropped and scaled up in Final Cut Pro, that is the information that Motion gets - you can't scale down the image to see more of the edges that have been cropped off.
    If you want more than one copy of the image passed via the drop zone, use Make Clone Layer from the Object menu.

  • How do you change a background image in an HBox control via actionscript?

    Hi All,
    I would like to change the background image of a HBox control
    when the user clicks on a tab (tabnavigator control). I call a
    function on the 'activate' method of a VBox control, within the
    TabNavigator. So for each of the tabs when a tab is selected an
    appropreate image is displayed in another part of the screen.
    Thanks for any insights/help
    regards
    Davej

    Binding a string variable and using the show() event instead
    of the activate event will work. See Below
    <mx:Script>
    <![CDATA[
    [Bindable]
    private var mystring:String = new String();
    private function dispAssocIMG(f3rd:String):void {
    mystring = f3rd;
    ]]>
    </mx:Script>
    <mx:HBox backgroundImage="{mystring}" id="first3rd"
    width="567" height="336" y="209"></mx:HBox>
    <mx:HBox id="mid3rd" width="457" height="336" y="209"
    x="567" backgroundColor="#956944">
    <!-- Tab Navigator -->
    <mx:TabNavigator height="336" width="457" >
    <mx:VBox label="about me"
    show="dispAssocIMG('image1.jpg')"></VBox>
    <mx:VBox label="test2"
    show="dispAssocIMG('image2.jpg')"></mx:VBox>
    </mx:TabNavigator>
    </mx:HBox>
    </mx:Application>

  • I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    Logged the call with SAP who directed me to 'Define settings for attachments' in IMG and setting the 'Deactivate Java Applet' & 'Deactivate Attachment versioning' checkboxes - problem solved.

  • Sort images within stack by rating?

    Hi Gang,
    I'm editing a massive job and there's one part of the process that is taking forever. After I've rated every image within a stack, I seem to have to resort them manually to be shown from highest rating to lowest rating, either by dragging or by using the "promote/demote" buttons.
    Is there any way to make images in a stack sort themselves by rating? This would literally save me hours of time.

    I know of no way to automatically stack by rating. You could create Smart Albums with only certain ratings included. I know that's not exactly what you wanted to do, but it would accomplish a segregation of your photos by rating.
    Sorry not to be able to provide an answer, but I don't think there is one.
    Joel

  • Linking an image from one page to an image within a slideshow on another page.

    I would like to link an image on my home page with an image within a slideshow on another page of my website. I can create the link, but when I click on the link, instead of taking me to the image within the slideshow, it takes me to the first image of the slideshow which I don't want. Is there a way to link to an image "within" the slideshow and not the first image?

    Hi
    You can create pages with specific images and then use link of images which will open the page with that specific image, link images within slideshow to show exact image within would not be possible with native Muse feature as by default slideshow will open the first image in target.
    Thanks,
    Sanjit

  • Scaled image doesn't appear

    Hi, can someone tell me why the scaling of the image does not work in the code below.
    I making a board game application with these inherited JLabel components used to display each players piece on a background created using an inherited JPanel. The image is correctly displayed on the JPanel at the correct location.
    The problem I'm encountering is that when I attempt to scale the image used the scaledInstance method it doesn't appear on the board but appears perfectly if I use the default image (comment out the scaled instance part of the line).
    I've tried downscaling as well increasing size, in case the image is too large and putting absolute values in but to no avail.
    Any help would be appreciated.
    Thanks
    package UserInterface;
    import java.awt.*;
    import javax.swing.*;
    public class PieceIcon extends JLabel
        //Create new image with the piece (symbol) chosen by the player
        public PieceIcon(String symbol,int pNum)
            playerNumber = pNum;
         pieceImage = new ImageIcon("./Images/"+symbol+".jpg").getImage().getScaledInstance(10,10,Image.SCALE_DEFAULT);
            // above line works if scaled instance part removed, even though scaled image smaller
            setOpaque(false);
        public void paintComponent(Graphics g)
           super.paintComponent(g);
           g.drawImage(pieceImage,boardPos[0][(MainFrame.getPlayer(playerNumber).getCurrentBoardPos())],
                                  boardPos[1][(MainFrame.getPlayer(playerNumber).getCurrentBoardPos())],this);
        private Image pieceImage;
        private int playerNumber;
        private static int[][] boardPos = (set of relative positions here, not displayed to make post easier to read)

    bump

  • Aligning an image within Text

    Is there a way to wrap an image within a Text Box? For example, in standard html I would just align an image to the "right" or "left" and insert padding accordingly. The text would then just wrap around and under. Is there an equivelent action in Captivate 5.0?
    I've been just putting text boxes on the page and leaving room and saving space outside of the text box for the image, then put another text box underneath it to make it appear as if it is "wrapping"?
    If not - any idea when this functionality will be appearing? Perhaps in 6.0?
    kstagg

    If you want to see something like this in Cp6 you need to request it as an enhancement.
    This is the official Adobe request page: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform&product=5
    With this site you cannot see what others have logged.
    And this is the unofficial site that we use and Adobe watches: http://captivate6ideas.ideascale.com/
    With this site you can see all the enhancement ideas and vote for the ones you like, as well as add your own if nobody else has already done so.

  • Set exported resolution for each image within InDesign

    I'm generating a document in InDesign destined only for the screen (as a PDF) and I'm wondering whether in CS6 the user can set the exported resolution separately for each image. i.e click on a image and set the resolution for that image. Reason: to allow end-viewers to zoom in on certain images and retain quality.
    And while I'm on the subject of changing resolution, a few years ago someone wrote a script for me (in response to a post), that when you clicked on an image within InDesign, resampled the original to 300 dpi, saved it, and made the necessary adjustments in InDesign so the image stayed the same size.
    Can CS6 do that? Or do I need to dig up the old script?

    > ... destined only for the screen (as a PDF) ...
    The developers of PDF will thank you for that statement!

  • Fix background image within div

    Hello
    I've done a lot of research about this, and tons os answers have come up, still, none solved my problem so far.
    I'm trying to make the background image within a div to be fixed when i scroll vertically.
    Have a template made, in which the only editable div is the rightdiv. (in red, to be easier)
    Here's my code
    CSS
    body {
    margin-top: 0px;
    margin-bottom: 0px;
    background-position: center center;
    background-image: url(../Images/bgdr.jpg);
    background-repeat: no-repeat;
    #wrapper {
    height: 875px;
    width: 1000px;
    margin-right: auto;
    margin-left: auto;
    background-repeat: no-repeat;
    #header {
    background-repeat: no-repeat;
    clear: none;
    float: none;
    height: 214px;
    width: 1000px;
    background-image: none;
    position: relative;
    padding-top: 10px;
    #leftDiv {
    clear: none;
    float: left;
    height: 500px;
    width: 245px;
    position: relative;
    text-decoration: none;
    #rightDiv {
    clear: none;
    float: right;
    height: 484px;
    width: 755px;
    position: relative;
    overflow: auto;
    #footer {
    height: 100px;
    width: 1000px;
    clear: both;
    position: relative;
    padding-bottom: 20px;
    And here is my HTML
    <!-- InstanceBeginEditable name="RightDiv" -->
      <div id="rightDiv" style="background-image: url(Images/informacao.png)">
      </div>
      <!-- InstanceEndEditable -->
    Well, thing is that on Internet Explorer 9, the background image will repeat vertically when i scroll vertically. On Chrome it will stay fixed on scroll (and that is what i want).
    I tried adding style="background-attachment:fixed" , but that will make the image align fix itself relatively to the whole page, not the div only. Also, it repeats itself 4 times to oocupy the screen. I can solve that by "no-repeat", but it still is fixed to the browser page, not the div.
    I've been trying to fix this for days.. Help would be much appreciated.
    Funny thing is that this only happens in IE9.. Chrome works perfectly.

    DevilUrd wrote:
    Didn't work. sorry, but i don't think i understood ur reply quite well..
    Here's what i used:
    <!-- InstanceBeginEditable name="RightDiv" -->
    <div id="rightDiv" background:  url('Images/informacao.png') no repeat fixed;>
    <tr>
            <td>textextextextextextextextext</td>
          </tr>
    <!-- InstanceEndEditable -->
    Could u pls be a little more detailed?
    sorry, but i'm still very unexperienced at this..
    That is not a valid way to write css into your page and will not work. You appear to be trying to use the background shorthand css property within the html tag itself. If you want to use an inline style, it would need to be within the style html attribute...
    <div id="rightDiv" style="background:url(Images/informacao.png") no-repeat fixed top left;">
    But it would be better to place it in your css instead...
    #rightDiv {
    clear: none;
    background:url(Images/informacao.png") no-repeat fixed top left;
    float: right;
    height: 484px;
    width: 755px;
    position: relative;
    overflow: auto;

  • Displaying image within a directory

    Hi everyone, i am doing a project on displaying image within a directory. But i am not sure how to do it. Is it possible to display all the images from a certain directory folder?? Thank in advance..

    Thank for reply. I know how to call a image from a folder and display it on the jsp page But I am trying to display all the images in that folder and display all of them on the jsp page like a online photo album. But i do not know how to do that. Any help or guide on displaying images from a directory. Thank!!

  • Resizing images within Mail not working in Snow Leopard

    Hi,
    I recently upgraded to Snow Leopard on both my desktop (iMAC Quad Core) and my MacBook Pro. I'm now experiencing an issue when I attach images within the Mail application.
    In the past, if I attached an image I could resize it by selecting the option at the lower right of the window and it would scale the image accordingly. Now if I select "large" it resizes the image as if I selected small. It's tiny, like 30KB. I tried it on both machines and I get the same thing.
    This was never an issue before upgrading to Snow Leopard. In the past if I selected "large" it would scale my image down to roughly 4X6 300dpi.
    Has anyone else found a fix for this issue?
    Thanks so much!
    Michael

    Hi Terence,
    thanks for your reply.
    But i have now a Problem!
    iPhoto 09 itself can send max. 10 pics in one mail. When i drag & drop more photos to mail as attachement, mail can´t resize photos with greater than 150dpi correctly.
    I have many photos greater than 150 dpi
    With new iPhoto 09 i can not send:
    1. more than 10 photos
    2. without "zipping"
    with mail i can send more than 10 photos at one time but i cant resize these images!
    Allso whe i use this way:
    http://discussions.apple.com/thread.jspa?threadID=2627690&tstart=0
    The only way to send more than 10 photos with resizing the images is:
    1. export these photos from iphoto to a folder with resizing function
    2. drag or attach these photos to a mail
    3. send mail
    4. delete the created folder with images
    5. empty trash
    iPhoto 8 can send many photos at one time including resizing and display the estimated size of mail (e.g. Megabytes).
    Taner

  • Sorting of images within a stack

    When working with stacks some strange things happen:
    - When trying to duplicate one image out of the stack into an album the whole stack is moved to the album. When I than delete this stack in the album the order of the images of the same stack in my projects is changed.
    - When rejecting images within a stack my rejected images are not automatically moved to the rejected images folder. Instead these images stay in the stack even so they are marked as rejected.
    - When sorting images within a stack by using different ratings and than trying to limit the image view by showing for instance only images with 3 stars or more nothing happens. Also showing rejected images only does not work within a stack. Instead showing images by rating is applied to the whole project and not only the stack
    Do I do something wrong or is this a known apperture bug?
    MBP   Mac OS X (10.4.9)  

    David, your understanding (use) of stacks is causing a conflict. The whole idea is basically to group a series of similar images and choose the best one of that series, called the Pick. Then, within that series you can rank those images in an order of Pick to next best, and so on. You can view stacks open or closed - when closed, the Pick is the one on top.
    Here's some info from the Help Menu that will help answer your questions:
    Note: When you place a stack in a book album or web gallery or web journal album, Aperture displays the stack pick. If you drag a stacked image that is not the stack pick into the book or web gallery or web journal album, Aperture reminds you to select the stack pick. If you don’t want to place the pick in the album, but want to use a different version from within the stack, select the version you want and then make it the album pick by choosing Stacks > Set Album Pick.
    Dragging Stacks
    You can drag an entire stack to a new location, and you can drag specific images within a stack to a new location. When a stack is closed, dragging the stack moves the entire stack. When a stack is open, you can drag individual versions to new locations in the Browser. You can also drag images into a stack. If you drag a stacked image into a different project, however, the entire stack moves to the new location.
    If you still want to be able to use a stacked image as you have stated, then take that image out of the stack, split the stack, or create a version of the image and remove it from the stack.
    Take a quick refresher through the help menu - it will give you some further details and ideas so you can accomplish exactly what you need to do.
    Hope that helps!!

  • Scaling image files for Slide presentation in Keynote

    I have had great problems importing and scaling images for Keynote presentations with approx 500+ images. Having tried to adjust the image to fit the full screen the scaling results in unacceptable pixelation. I seem to have solved this now by batch processing my image files and saving them as PDF files. These are then imported from the Aperture Library as iPhoto wont recognise the PDF file format!
    It's a pity that Keynote has so many restrictions for use in Slide/music presentations, having seen incredible professional results with Pic2exe (which unfortunately at present is not available in Mac format - tho the Win exe file will run I am told).

    Please tell us what you are really trying to do!!
    You know like dumb stuff like where are the images from? What's their resolution? If you';re using Aperture you can't be a newbie. 
    You can achieve incredible professional results in Keynote, but you need to know how it wants to work.
    Kelly is right. This is not just a ***** session but a place to get real help from real people.
    Silly things like Image Placeholders will make your life much simpler. etc.

  • Black background when scaling images with transparent background

    I am implementing Zooming functionality for reports which have some icons. I am trying to scale icon by scaling its image. But the problem I am facing is that the icons have transparent background and the scaling puts a black background in place of transparent. Is there any way to maintain its transparency or better yet, Is there anyway to put a white backgound instead of the black one that is created by default ? Here is my code
         public static Icon getScaledIcon(Icon icon){
             if(icon instanceof ImageIcon){
                  Image outImage = ((ImageIcon)icon).getImage();
                      return new ImageIcon(getScaledImage(outImage));
             }else{
                  Image outImage = new BufferedImage(icon.getIconWidth(),
                            icon.getIconHeight(),
                            BufferedImage.TYPE_INT_ARGB);
                    JComponent comp = new JComponent(){};
                    icon.paintIcon(comp, outImage.getGraphics(), 0, 0);
                    return new ImageIcon(getScaledImage(outImage));
        public static Image getScaledImage(Image image){
             image = image.getScaledInstance((int)(image.getWidth(null) * getScale()),
                           (int)(image.getHeight(null) * getScale()), Image.SCALE_SMOOTH);
            return image;
        }I haven't done much image manipulation , so I would really appreciate any help or advice.

    I have also not done much of image work. But I guess you could achieve your functionality of showing scaled image in the screen by not scaling the image and show it, instead scale the image in paint method by calling g.drawImage giving the height and width. But use high resolution images so that scaling is good.
    If you do in this manner, you could give any colour you want as background to fill the transparent area or leave it as such.
    Regards,
    techece.

Maybe you are looking for

  • Dvd Audio playback is slow and with pops sou

    Hi, i have just got a dvd audio (night at the opera from queen ) and i want to enjot the high quality of this fromat, but with creative media source dvd audio player there's a problem in playback, i can see the lists of the song, select it, but when

  • Booting from alternate disk in Sol 10 x86 1/06

    Hey all-- I'm trying to set up a mirrored root filesystem on an x86 box with two IDE disks. It's running solaris 10 1/06. I've done this plenty of times on sparc boxes, but only once on an x86 box and after the metaroot, I had to edit bootenv.rc to p

  • Quicktime Pro 7: Screen Recording is missing

    Hello I downloaded Quicktime Pro 7 to be able to record my screen. The problem: there is no function "New Screen Recording" appearing! There are only these functions: New Player New Movie Recording New Audio Recording New Screen Recording ist missing

  • Badi  BADI_SD_V46H0001~EXIT_SAPLV46H_001

    Hello, I am using badi BADI_SD_V46H0001~EXIT_SAPLV46H_001 To copy pricing conditions from contract to sales order. Because the SAP code runs thru the user exit twice, we have to check whether Pricing was already run. If so then we exit from the user-

  • Fuzzy screen, moving pixels, only in colour, not in grayscale NOT zoom prob

    Hi, I was using messenger on my macbook, which is about 30 days old, and the screen began to go a bit fuzzy in one patch, I closed the program and now the screen is just fuzzy all over. The best way to describe this is like a telly with interference,