5 Replies Latest reply on Dec 19, 2009 4:59 PM by SherlockSuperdude

    Need help loading external images


      I have looked everywhere I can for this, and I am at wit's end.


      I have what is probably a very simple questioin-


      All I need to do is load a bunch of thumbnails into small pictures frames that the user can scroll back and forth. If you go to http://www.apple.com/mac/ you'll see a slider at the top. This is basically what I want to do, but in flash, and I need to load the images dynamically.


      I can't figure out the best (or any way) to do this. I have created a thumbnail movieclip "symbol", but if I drag 5 instances out, and load an image, it changes the image in ALL of them. I want to have a different image in each one. I have been a programmer for 15 years, but for some reason I just don't get it. I can change the size, rotation, etc of each instance, but if I change the image, it changes in all of them. I am begging for help, or some code here- my job literally depends on it- please don't think that means I made a promise I can't keep- but the company needs this done to launch a major website and I'm the only programmer in the company.


      How do I change each instance to a different image? That's really all I need to know. Do I copy the object, and not create an instance? I haven't used flash in years so I'm completely, utterly confused. If you give me example code, and show me how to do this, I'll buy you a game/blueray/dvd from bestbuy.com. Seriously, I need help.


      I want it to drag back and forth like an iPhone- I can do that, but the number of images/picture frames is arbitrary.


      It's 3:00 in the morning, and I'm about to sleep on the office floor. lol, please

        • 1. Re: Need help loading external images
          Ned Murphy Adobe Community Professional & MVP

          Since you didn't identify which version of actionscript your using, I'll have to wing it with a generic reply, though I'd probably go that way anyways since I don't normally hand out complete design solutions for things this complex.


          If you want to load things dynamically, then you don't necessarily need the thumbnail movieclips, just the thumbnails.... the movieclips can be created dynamically as needed.


          As you load each image you create an empty movieclip and load the image into it so that it becomes an interactable item that you can click on.  and you assign that movieclip some mouse code so that clicking it does something in the way of triggering something.


          Once you have the movieclip all prepared, you add it to another movieclip where you line up thumnail movieclips, keeping track of where you are x-wise so that you place them one after another.


          Once you have that larger movieclip assembled with all you thumbnail movieclips, you assign it some scrollable functionality based on its position on the stage and its width.


          The example you pointed to uses buttons to move the larger movieclip in sections relative to product groups.  All that really involves is establishing an x location that marks where the larger movieclip should Tween to (actionscript Tween).  But you can have a variety of controls, so I'll leave that to you to decide on, just remember that scrolling is just Tweening the x-position of the container movieclip.

          • 2. Re: Need help loading external images
            carl schooff Level 3

            The apple thing is all javascript. Check out this jquery implementation for a non-flash way of doing it. As an experienced programmer you may be able to just hack it to your needs:




            On the Flash side, what Ned says is correct. If loading dynamic images is your main hang-up, just google "flash image gallery tutorial". You will find tons of free samples with full source that outline the process of image loading into seperate containers.

            • 3. Re: Need help loading external images
              SherlockSuperdude Level 1

              I am using Flash CS4 on PC. I believe it's actionscript 3?


              Thanks alot for the explanation. That makes sense. Is there a way I can create the movieclips beforehand, and just load a different image/url/whatever into each instance? The reason is for each movieclip I have created a frame around it, and when you mouseover the clip, I want it to grow a little bit and display text over it (so I created an animation). I can figure this out, and have done it- the problem is that it seems that when I create a new instance from my "myMovieClip" object or whatever, and I create several instances- I go to change the image and it changes it in all of them. What I really need to do is create a new movieclip that "inherits" everything from the one in the library, but not just an instance, so that I can go and change any aspect of each one, without changing it in all of them. Does that make sense?

              • 4. Re: Need help loading external images
                Ned Murphy Adobe Community Professional & MVP

                If I'm following what you want, then what you need to do is create individual library symbols for each image in its frame.  That's likely the only approach you can take if you want to avoid using code.


                But you could take a coded approach that would probably be easier to manage and less weighty in terms of file size--create one master frame movieclip that has a blank movieclip planted in it for loading the image into, and assign the frame symbol a class ID so you can add them dynamically.

                • 5. Re: Need help loading external images
                  SherlockSuperdude Level 1

                  Gotcha. Of course I would like to make the file size smaller, but honestly, for v.1, I just need to get the dang thing done! So I think I will create 5 different symbols, and then manipulate them so it looks like there are infinite when scrolling. For example, it will at most show 5 at a time, so when scrolling right, and 5 scrolls out of view, I'll load the new image I need and place it back on the left side so it scrolls into view. I know this is far, far from optimal, but for the mockup it just needs to look like it's working. I can worry about doing it "the right way" after the design and functionality are finalized. I'll look up some flash image galleries and see if I can find any working code. Unfortunately, a lot of the code I've found seems to be < actionscript 3 and I get errors about depricated or obsolete function calls. I find Flash incredibly confusing compared to .NET but I need to learn it.