3 Replies Latest reply on Jun 2, 2008 5:46 AM by Greg Dove

    XML loaded thumbnails not working properly

    Level 1
      I'm creating an XML photo album which displays thumbnails and a main display section. Loading thumbnails is working fine, but my thumbnails are not responding as buttons. Please see code below. Am I missing something?
        • 1. XML loaded thumbnails not working properly
          Ankur Arora Level 1
          Hi Cristian,
          This is a very basic problem, you are creating onPress event on to the same clip in which you are loading an image. Just create another new movieclip in thisMC and load thumbnail image in to that. But remember to create onPress event on thisMC only not on new movieclip. Please let me know if this solution not works for you.

          Thanks & Regards
          Ankur Arora
          Project Leader(Flash and Flex)
          let your thoughts fly to others... you will become rich.

          • 2. Re: XML loaded thumbnails not working properly
            clbeech Level 3
            sorry Ankur, I disagree - the problem is not that the handler is being assigned to the first MC, but rather that is is being assigned previous to there being any content within it - and if using your method you would still need to construct an MC instance that has 'something' in it that is the same size as the loaded image (eg. like a API draw box, or another MC from the Lib that is the correct size)

            a better solution is to assign the handler using the onLoadInit method of the MCL class, as I will show below.

            However Christian, I am wondering about this call: loadClip(this.id) - if you have defined a method with this name, that will be in conflict with the same named method of the MCL class, i would change that to like 'loadImage' or something ;)
            • 3. Re: XML loaded thumbnails not working properly
              Greg Dove Level 4
              I'm going to sit on the fence and agree with both of you. :)

              Loading an image into a target clip knocks off the property assignments, and although I haven't tried that specifically with an onPress handler, I'm guessing that's what's happening here too. I've come across this in the past also using the Zigo tweening engine. So Ankur's suggestion to load the image into a child clip of the current target should work, because the properties assigned to the current clip, which is now the parent should not be affected.

              And clbeech's method would work too...by delaying the assignment of the properties until onLoadInit, you can be sure that they will be assigned after the image has loaded... and therefore will be successful.