11 Replies Latest reply on Nov 20, 2011 1:14 PM by kglad

    UI Loader Question

    darling67 Level 1

      Hello, everyone! Me again!


      I've got a very simple question THIS time.......


      I've got a UI loader that will load multiple images (actually, multiple .swf files). Each "image" will enlarge upon mouse-over. So, I've got a smaller image and a larger image that load in the same UI loader. I got it to FUNCTION ok, but the images are not centering inside the loader.


      How do I make the loader know to load each image - and they're all of varying, non-uniform sizes - centered within itself? Is that a script command?


      I should mention.... I determined a maximum height for the vertical images, and then a subsequent maximum width for the horizontal images. That way, there's at least two pre-determined coordinates for the loader to load the "enlargements" upon mouse-over.


      Thank you!

        • 1. Re: UI Loader Question
          kglad Adobe Community Professional & MVP

          you're using one uiloader to load more than one swf?

          • 2. Re: UI Loader Question
            darling67 Level 1

            Yes. It's a slideshow that used to be just static images.... but the client decided that he wants each image to enlarge upon mouse-over.


            So, I retained the UI Loader that the original images would load into, created separate "button" movie clips, saved them all as .swf files, changed the file names in my xml sheet, and "Voila!" - animated slideshow images!


            I just need to figure out how to center them within the (enlarged) UI loader.


            if you know of a better/more efficient way, I am all ears!



            • 3. Re: UI Loader Question
              kglad Adobe Community Professional & MVP

              why not load one image (the larger) and scale it down when it completes loading and on mouseout and scale it up on mouseover?

              • 4. Re: UI Loader Question
                darling67 Level 1

                Hmmmm. Would that be a better use of Flash to do it that way? Thing is, the "images" fade-in with some alpha tweening in the script as it is. I don't want to make them do too much stuff upon loading.


                After thinking on this a bit..... should I just do away with the idea of making my images .swf files, and just creating movie clips for these? I originally wanted them to be movie clips, but the mouse-over "button" effect was giving me problems when naming them "fileName_mc". Buttons as movie clips have always given me output trouble.


                Bottom line is that I really want is to make this modification as seamless as possible - without too much extra work or changing too much of the existing assets. I want to keep my site as is and only make changes to these 20 image files. I've spent too much time on this thing as it is. Thanks.

                • 5. Re: UI Loader Question
                  kglad Adobe Community Professional & MVP

                  the least changes would be to just simplify what you're already doing and do what i intimated:  load one large image per loader (i'm not sure why you're using a uiloader because the loader class is pretty easy to use and more flexible than the uiloader), assign a position, assign mouse listeners and scale the loader in the listener function.

                  1 person found this helpful
                  • 6. Re: UI Loader Question
                    darling67 Level 1



                    Ok. I will try as you're suggesting. Thanks!


                    Will come back with a "Correct Answer" once it's done.


                    P.S. Pardon my apparent Flash novice caliber..... but what's the difference bvetween a "Loader" and a "UI Loader". I always thought UI Loaders ere what Flash uses for multiple image loading. It's THE Component for such things, yes?

                    • 7. Re: UI Loader Question
                      kglad Adobe Community Professional & MVP

                      correct, the uiloader is a component that allows you to load swfs and bitmaps.


                      the loader class does the same thing. 


                      components are movieclips that should simplify and streamline your work-flow. 


                      the flvplayback component is an example of a "good" (in my value-system) component.  you can use it to play flv/f4v files.  that's a little more difficult to do without the component.  but where the component really speeds development is if you want a play/pause button, volume button, fullscreen button, mute button, play-progress/download-progress bar etc.  pick the skin that has what you want and you don't need to code for any of that functionality.  that's a worthwhile component.  so, are the colorpicker, list component and datagrid component.


                      the uiloader code doesn't do anything better or more easily than the loader class and is more limited than the loader class.  it's what i would call a useless component.  i feel the same way about the button component and label component.


                      and there are some in-between components like the uiscrollbar and scrollpane.  i can see why some people would find them useful but i never use them.

                      • 8. Re: UI Loader Question
                        darling67 Level 1



                        Not trying to be stubborn, but since I had already spent a lot of time creating these "mini swf files" for my slideshow, I really didn't want to forsake all that work. So, I am using the UI loader to load them....


                        I entered in the UI loader "centering" script that you provided:


                        workLoader.content.x = -.5 * workLoader.content.width;

                        workLoader.content.y = -.5 * workLoader.content.height;


                        ... but they're still loading on the left side of the UI loader.


                        Wonder why there's no "center" option in the UI Loader's properties pane. That would have made sense to me to have such an option to check off in the Properties pane.



                        • 9. Re: UI Loader Question
                          kglad Adobe Community Professional & MVP

                          that's the problem with components.  they have different code for many common properties, methods and events.  try the move() method.  a lot components use that.

                          • 10. Re: UI Loader Question
                            darling67 Level 1

                            I'm not sure what the move() method is, or how I'd enter it into the script. Even after doing google searches, etc., I couldn't find a proper context in which to use it in.

                            • 11. Re: UI Loader Question
                              kglad Adobe Community Professional & MVP

                              use the adobe help files.  check the uiloader class'es methods.