Equal spacing between the images of uniformed height but variable widths with AS3?

I have to figure out how to insert images with variable width with equal spacing intervals.
Here is where I got so far:
function buildScroller(imageList:XMLList):void{
          trace("build Scroller");
          for (var item:uint = 0; item<imageList.length();item++) {
                    var thisOne:MovieClip = new MovieClip();
  var currentX = 90;
                    var spaceBetween = 20;
  var currentImageWidth = Number(imageList[item].attribute("width"));
thisOne.x = currentX;
thisOne.x = (currentImageWidth+spaceBetween)*item;
I can see that my images are being spread out on the page and if I change the number in var spaceBetween it affects the spacing. However the spacing is not uniformed. I can not figure why. Perhaps because I can not properly retrieve the image widths from the xml file. I assigned a width in xml file in the following manner:
<images>
<image src="appThmb_imgs/A-illuminatorUpLit_xsm.jpg" title="UpDownGlowingVase" url="http://www.888acolyte.com" width="132"/>
<image src="appThmb_imgs/ATI-1-bgpA_xsm.jpg" title="CoolingReflections" url="http://www.888acolyte.com" width="117"/>
<image src="appThmb_imgs/ATI-2-zenC_xsm.jpg" title="OrchidsUnderGlass" url="http://www.888acolyte.com" width="263"/>
<image src="appThmb_imgs/SilverBloom_RGB_xsm.jpg" title="SilverBloom" url="http://www.888acolyte.com" width="148"/>
</images>
they correspond to actual image width. I do however want them to be scaled at 50% of their actual width.
Any ideas if I am missing a line of code or don't call out images properly?

Thank You for your reply.
I tried to implement it but images are still jambled together.
Perhaps it has something to do with the fact that I specify the actual width of the image in the XML file but then define it as a scaled value in the code later on (11th line at the bottom of the code):
    mc.height = 110;
This height definition will just give the width proportional to the height. Does it mean that I can not specify the height as it is?
Also can be there a mistake in the XML file? I just assigned the width number as it is in pixels for each image. Here is an example:
<images>
<image src="appThmb_imgs/RosesGallasGalore_RGB_xsm.jpg" title="RosesGallasGalore" url="http://www.888acolyte.com" width="131"/>
<image src="appThmb_imgs/SangriaBling_RGB_xsm.jpg" title="SangriaBling" url="http://www.888acolyte.com" width="233"/>
<image src="appThmb_imgs/SilverBloom_RGB_xsm.jpg" title="SilverBloom" url="http://www.888acolyte.com" width="148"/>
</images>
There were no errors in the output or compiler errors tabs.
Here is my code in its entirety:
import com.greensock.*;
import com.greensock.easing.*;
//load xml
var xmlLoader:URLLoader = new URLLoader();
/////Parse XML
var xmlData:XML = new XML();
var xmlPath:String = "app_thmbs_imgsModfd.xml";
xmlLoader.load(new URLRequest(xmlPath));
trace("loading xml from: " + xmlPath);
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
function LoadXML(e:Event):void {
          trace("xml load complete");
          xmlData = new XML(e.target.data);
          buildScroller(xmlData.image);
/////Build Scroller MovieClip to Contain Each Image
var scroller:MovieClip = new MovieClip();
this.addChild(scroller);
scroller.y = 30;
/////Parse XML
//build scroller from xml
          var spaceBetween:int = 20;
          function buildScroller(imageList:XMLList):void{
          trace("build Scroller");
          var nextX:int=spaceBetween; //not sure where you want to start;
          for (var item:uint = 0; item<imageList.length();item++) {
                    var thisOne:MovieClip = new MovieClip();
                    thisOne.x=nextX;
                    nextX=int(imageList[item].attribute("width"))+spaceBetween;
                    //outline
                    var blackBox:Sprite = new Sprite();
                    blackBox.graphics.beginFill(0xFFFFFF);
                    blackBox.graphics.drawRect(-1, -1, 124, 107);
                    thisOne.addChild(blackBox);
                    thisOne.itemNum = item;
                    thisOne.title = imageList[item].attribute("title");
                    thisOne.link = imageList[item].attribute("url");
                    thisOne.src = imageList[item].attribute("src");
                    thisOne.alpha = 0;
                    //Loading and Adding the Images
                    //image container
                    var thisThumb:MovieClip = new MovieClip();
                    //add image
                    var ldr:Loader = new Loader();
                    var url:String = imageList[item].attribute("src");
                    var urlReq:URLRequest = new URLRequest(url);
                    trace("loading thumbnail "+item+" into Scroller: " + url);
                    //assign event listeners for Loader
                    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
                    ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
                    ldr.load(urlReq);
                    thisThumb.addChild(ldr);
                    thisOne.addChild(thisThumb);
                    //create listeners for this thumb
                    thisOne.buttonMode = true;
                    thisOne.addEventListener(MouseEvent.CLICK, clickScrollerItem);
                    thisOne.addEventListener(MouseEvent.MOUSE_OVER, overScrollerItem);
                    thisOne.addEventListener(MouseEvent.MOUSE_OUT, outScrollerItem);
                    //add item
                    scroller.addChild(thisOne);
          trace("termination of build scroller");
function clickScrollerItem(e:MouseEvent):void{
          trace("clicked item " +e.currentTarget.itemNum + " - visit url: " +e.currentTarget.link);
function overScrollerItem(e:MouseEvent):void{
          trace("over"+e.currentTarget.title);
function outScrollerItem(e:MouseEvent):void{
          trace("out"+e.currentTarget.title);
function completeHandler(e:Event):void{
          //trace("thumbnail complete "+e.target.loader.parent.parent.title)
          TweenMax.to(e.target.loader.parent.parent, .5, {alpha:1});
          //size image into scroller
          resizeMe(e.target.loader.parent, 140, 105, true, true, false);
function errorHandler(e:IOErrorEvent):void{
          trace("thumbnail error="+e);
function resizeMe(mc:DisplayObject, maxH:Number, maxW:Number=0, constrainProportions:Boolean=true, centerHor:Boolean=true, centerVert:Boolean=true):void{
    maxH = maxH == 0 ? maxW : maxH;
    mc.width = maxW;
    mc.height = 110;
          mc.scaleX=mc.scaleY
          if (centerHor) {
                    mc.x = (maxW - mc.width) / 2;
          if (centerVert){
                    mc.y = (maxH - mc.height) / 2;

Similar Messages

  • How do I reduce the space between the images in the fotopage?

    Hi
    I have made a Photopage - and some of the Photos are croped and when I add them to the page there is a loot of space between the one above and underneath
    look at this screen shot
    http://skitch.com/baiaz/n8un4/iweb
    or go to my photopage:
    http://web.me.com/baiaz/Adino/Galleri/Sider/UKE1.html
    Then you will see what I mean.
    Is there a way to make them more even???? So the gap is not that big when I crop the photos?

    The photogrid is square. Your pictures are rectangle. That's difficult to fit.
    To change the settings of the photogrid, click on an image.
    You can change the number of columns, the spacing between the images, the numbers of lines for the caption and the number of pictures on a page.
    It's all there.

  • ABAP webdynpro how to give spacing between the UI Elements in a view

    Hi Expert,
    I am very new to webdynproapplication development. I am stuck in changing the look of the ui  elements of the view.
    Cud anyone explain  how  to set the spaces  between the  UI Elements on  a View is there any method ?
    I have set the Layout property  to Matrix layout. But here I am unable to set the spacing between the deffernet elements  as it is taking it automaticaaly  and I am not able to allign  all the  Elements.
    Need your help!.............thank you
    Moderator message: wrong forum, please have a look in the dedicated "Web Dynpro ABAP" forum.
    Edited by: Thomas Zloch on Apr 15, 2011 10:17 PM

    Hi anushree.,
    If u are using matrix layout:
    In Layout Data select MatrixHeadData to display UI in next line.,
    If u want to give space  between UI elements in the width enter 50, 60, 70 or what ever space u want.
    Also in the vGutter u can select medium ,  large ,  medium with rule  to give space between UI elements.
    n if u want to give space between lines  ., in the height enter 30 40 or whatever spacing between lines u want.,
    Matrix layout is a good layout., and u can play with colspan , hAlign, vAlign, vGutter, width and height options.,
    If u dont like the layout with these options then use Grid layout., where u can give custom spacing., with the help of Left Padding, Right Padding, Top Padding, Bottom Padding.
    reply if u need some more clarifications.,
    Thanks & Regards
    Kiran

  • Get Spacing between the two elements

    Hi,
    I have two groups and  a table in  in my layout .
    In groups I have two input fields each
    I want to provide the spacing between the groups.
    How to do the above,
    Edited by: SAP LEARNER on Nov 12, 2009 12:29 PM

    hi ,
    insert INVISIBLE element bewtween ur two groups
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/0f/f08841e3af1609e10000000a155106/content.htm
    keep the layout like this :
    Group1 ( MAtrix Head Data ) , n INVISIBLE ELEMENT(s) ( Matrix Data) , Group2 ( MAtrix Data )
    u can find example in the Web Dynpro Application  WDR_TEST_UI_ELEMENTS.
    also refer the related threads:
    Re: webdynpro abap
    Re: Not able to display fields in new line while designing form?
    n the other alternative ( though I wud recommend u to go with the first alternative ) , is insert a Text View UI and in the TEXT property of the UI , do not enter any text
    regards
    amit
    Edited by: amit saini on Nov 12, 2009 1:01 PM

  • I would like to change the spacing between the words for the product names, they look double spaced at present.

    A simple question I think, I would like to change the spacing between the words for the product names, they look double spaced at present. On the home page, and product pages. Not sure where to change this in the css here is the site; http://top10shop.businesscatalyst.com

    That site is using an old font technology called cufon, it uses canvas to draw the text into the font you want. Not really good for modern websites.
    It is what the font was and how it was made. I never used Cufon but the documentation is here - Usage · sorccu/cufon Wiki · GitHub At a glance there are no render options for the double spacing so I am guessing it was how the font was generated.
    I would scrap all of that completely tbh.

  • How can I shrink the spacing between the icons in the bookmarks toolbar?

    Hello everyone!
    I would like to open up some space in my bookmarks toolbar (also on the navigation toolbar if I can) by reducing the spacing between the icons. Is there any way to do this without the need of some third party program? If not, which one should I download?
    Curious thing is that a few days ago I did not have this problem at all, all my bookmarks were visible in the toolbar regularly, neat and tight. Now there is that boring guillemet sitting there at the corner...
    And this is the line where I thank you quite a bit for your interest towards my problem. So thank you very much:)
    With respect
    Arial

    You're welcome
    You can also remove the text labels with code in userChrome.css and if necessary adjust the margins as you like.
    Add code to the userChrome.css file below the default @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    The customization files userChrome.css (interface) and userContent.css (websites) are located in the chrome folder in the user profile folder.
    *http://kb.mozillazine.org/Editing_configuration
    <pre><nowiki>#personal-bookmarks .bookmark-item > .toolbarbutton-text {
    display:none !important;
    #personal-bookmarks .bookmark-item > .toolbarbutton-icon {
    margin:0px !important;
    padding:0px !important;
    </nowiki></pre>
    *https://developer.mozilla.org/en/CSS/margin
    *https://developer.mozilla.org/en/CSS/padding

  • How can I use some of the image i am working on to paint with? like if I wanted to give someone an extra eye in the forehead, ow could i then paint their own i in the forehead? I know there is a paint tool for that, i just can't find it ... :/

    How can I use some of the image i am working on to paint with? like if I wanted to give someone an extra eye in the forehead, ow could i then paint their own i in the forehead? I know there is a paint tool for that, i just can't find it ... :/

    It sounds like you are talking about the cloning tool?
    Tool looks like this:
    Then when selected you can change the size of the brush and using Alt (windows) and Command (Mac) to select your region you want to copy then start to create you cloned image.
    Hope this helps?

  • Is there a way to retrieve photos which were accidentally erased?  I can still see all of the images in my library but can not open them?  Thanks

    Is it possible to retrieve photo images which were deleted by mistake.  I continue to see all of the images in my library but am unable to open them  Thanks

    Are you asking about iPhoto on your Mac? This is the iPhoto on IOS devics forum.
    What is your iPhoto version? And what happened to delete your photos?
    Do you mean, you see the images in your iPhoto library, when you are browsing them, but you cannot edit them?
    Then probably the original master image files are no longer there, but the previews are. If you are using iPhoto '11 you can see the Previews inside the iPhoto Library in the folder "Previews", when you ctrl-click the iPhoto Library and select "Show Package Contents".

  • Generally I shoot photos in RAW, however I shot some images using my D100 in Large fine format.  I am able to view the images on my camera but I am unable to see the images in Lightroom.  How do I resolve this problem?

    I am having difficulty viewing large fine J-peg files (Nikon D100) in Lightroom.  I can see the images on my camera but I do not see the images after I have imported the images from my card reader.  What is the best way to trouble shoot this?  I shot RAW images a few days earlier I didn't have any problems.

    1. You did not get an error message telling you that your iPhoto library was getting full. You got a message telling you that your HD was getting full, right?
    OS X needs about 10 gigs of hard drive space for normal OS operations - things like virtual memory, temporary files and so on.
    Without this space your Mac will slow down as the OS hunts for space on the disk, files will be fragmented, also slowing things down, apps will crash and the risk of data corruption - that is damage to your files, photos, music - increases exponentially.
    Your first priority is to make more space on that HD. Nothing else can be done until you do.
    Purchase an external HD and move your Photos and Music to it. Both iPhoto and iTunes can run perfectly well with the Library on an external disk.
    Your Library has been damaged from being run on an overfull disk.
    How much free space on it now?

  • When I upload photos, some of the images do not show, but appear as a dotted square. has anyone had this problem?

    when I upload photos, some of the images do not show, but appear as a dotted square. has anyone had this problem?

    Hi Terence, When I am uploading photos from a memory card,not all of the photos show up on I photo as a photo image, but show up as a dotted square line. For example, I just added 12 photo from two days. The first day had 5 photos, but only 4 show up as images, then there is 1 as dotted  a square. The next day, there 7 images, with only 4 showing up as photos, and three as the dotted squares.
    I am using I photo 11, 9.1.1.
    Thank you

  • TS2756 iam using iphone 4S with win 7 PC and i cannot connect to the internet through my phone but i tried with my other 4S and it works but what should i do for the first iphone 4S???

    iam using iphone 4S with win 7 PC and i cannot connect to the internet through my phone but i tried with my other 4S and it works but what should i do for the first iphone 4S???
    as i said i have two iphone 4S,,,,,
    1st one --- has os 5.1
    2nd one has os 6.0
    i tried 2nd one with carrier reliance gsm nd it works with that personal hotspot setting using USB...
    but i want to connect the first 4S with carrier TATA DOCOMO GSM but its not working with the same USB feature????
    plz reply asap...!!!
    thnxxx in advance!!!

    If not this:
    iOS: Wi-Fi or Bluetooth settings grayed out or dim
    One user reported that placing the iPod in the freezer fixed the problem.
    Also heating sometimes works. See:
    Why can't I select my wifi settings?
    A trick that works frequently with iPhones:
    Settings > AirPlane Mode ON, Do Not Disturb ON
    Power down and wait 5-10 minutes
    Power up
    Settings > AirPlane Mode OFF, Do Not Disturb OFF
    If not successful, an appointment at the Genius Bar of an Apple store is usually in order.
    Apple Retail Store - Genius Bar
    Then:
    Does the iOS device connect to other networks? See other networks? If yes that tends to indicate a problem with your network.
    Does the iOS device see the network?
    Any error messages?
    Do other devices now connect?
    Did the iOS device connect before?
    Try the following to rule out a software problem:                
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    .- Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - Wi-Fi: Unable to connect to an 802.11n Wi-Fi network      
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    If still problem and it does not connect to any networks make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar

  • Have lost the sound on my ipad:( but it works with the earphones.i have done the mute button and restart stuff ,still no luck .help please

    Have lost the sound on my ipad:( but it works with the earphones.i have done the mute button and restart stuff ,still no luck .help please

    Hi, sill no joy with my sound on my iPad .the sound only works on one app ( Annie ) and the ring volume and it works for about 5 seconds after I switch it on . Was talking to apple and they said the reset my iPad and this will fix it .done this and it is still not working only with earphone and Annie. What next ?As they said this is unheard of as it was the upgrade to iso6 that caused this problem . Help

  • Is there a way to edit a cell?  I need to put some spacing between the check boxes...  I already have the whole form done 60 plus text cells, except 5 check box cells.  Is there a way to edit existing text?

    Hi,
    I am new to the forum, because I usually don't run into stupid format issues.  I create most of my forms in word or excel then import them into PDF.  I need help with figuring out if I can edit some text without having to redo the entire document.  5 cells are off... really be steamed if I have to do it all over.

    Acrobat can make limited edits to the text on a page, but the control you have is limited and may not be sufficient for what you need to do. To access the text editing tool in Acrobat 11, select: Tools > Content Editing > Edit Text & Images
    and then click where you want to edit the text, and see what happens when you attempt to make the changes you want.

  • Aperture cant find master yet the image is showing up but i cant edit it

    pls help i had some hot images of for my clients port while doin some transfering aperture closed down not it say that some of the images are not readable format and the others that show up have a sliced rectangle badge in the corner but the image is not editable and when u try to do anythin wit it say that it cant find the master image and the duplicate files that were there were deleted i tried to re import them and now they are there but they are not helping how do i bring back the masters or reconnect them ... pls help
    g4 powerbook   Mac OS X (10.4.6)  

    I lost an image in the same way---Aperture crashed while I was moving the image. But I was able to recover the image and in the process learned a lot about how Aperture works from the point of view of storage and security and back-up. So
    1. Do you have a back-up of your Aperture Library in an Aperture Vault? If so, you can run Restore Library from the Vault. But this is a fairly lengthy process.
    2. If you have a back-up, you can go to it and "Open Package Contents" using the Finder; and then find the image missing from your Aperture Library and make a copy to your Desktop; then Import the image back into your Aperture Library.
    3. If you don't have a back-up---and this is a very dangerous way to live!---try Rebuilding the Aperture Library. To Rebuild, quit Aperture; then hold down Command and Option while rebooting Aperture; and then follow the Rebuild instructions.
    4. Another possibility, which is similar to the procedure used when a document becomes corrupted and won't open, is to find your problem image file in the Aperture Library (use "open package contents" in the Finder); copy it to the Desktop and see if it will open in Preview. Sometimes copying a corrupted document or image file will correct the corruption. If the copy opens in Preview, re-Import the image into Aperture and try it there.
    And, after all is said and done, be sure to have a back-up of the Aperture Library at all times. It will save your skin over and over.

  • Using Pages 5.2.2: When I drag an image into my document, I lose the related text.  I can crop the image, make it smaller, but it is surrounded by blankness that overrides the text.  Help?!

    Using Pages 5.2.2, MacBook Pro, OSX 10.9.5:  I cannot drag an image into my document without it obliterating the text.  Even after re-sizing,  the image just becomes small inside a larger blank area that appears to cover the saved text.  Help?

    Using Pages 5.2.2, MacBook Pro, OSX 10.9.5:  I cannot drag an image into my document without it obliterating the text.  Even after re-sizing,  the image just becomes small inside a larger blank area that appears to cover the saved text.  Help?

Maybe you are looking for

  • Dynamic Assign Statement is not working in 4.6C

    Hi Team, I have done the following coding to get teh dynamic value sof a field but the assign statement is failing... Its returing the sy-subrc as 4. LOOP AT <t_tab> INTO <s_tab>.     LOOP AT t_flds.       CONCATENATE '<s_tab>-' t_flds-fieldname INTO

  • System freezes every time I use a Java based app

    Hi all, Very new to all this as I don't really know what to do, where to post or really how to ask about this. It started out that I wanted to try to use JAlbum, a program that creates photo albums to share on the web etc..... I upgraded the Java app

  • Visual Studio and BPC 10.0

    Hi all, I'm a relatively new Planning Consultant and on a new project have the requirement of having an input screen for the allocation of time, for an individual, against a project. Examples of the required input are: - Allocate Nick Carter, to Proj

  • Misaligned printing

    I am printing a 4x6 PDF exported from InDesign. It must align with an Avery Template that I recreated. I have done this successfully in the past, but now am having the following problem. The image starts to print about 1/8" too soon and cuts off the

  • Error in renderPDF service

    hello, as i am trying to call a renderPDF sevice in workbench usig java  i got the following error,i also tried using Java API for render pdf. ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException in method: public abstract java.lang.Object c