10 Replies Latest reply on Sep 14, 2007 1:37 AM by Greg Dove

    ScrollPane a real pain

    Beatie3 Level 1
      Yesterday I had trouble with the overflow of a scrollpane stopping buttons working. I rebuilt everything with the buttons on the left of the scollpane and now the buttons work, but ... now it refuses to scroll horizontally. I rebuilt yet again shifting everything on the left hand side of the scrollpane to being above the scrollpane, just in case something was stopping it from scrolling, and it still won't scroll horizontally. I really can't work it out and I'm really running out of time.

      Any assistance would be greatly appreciated. Here's the code that makes the scollpane and the init function of the whole object:

        • 1. Re: ScrollPane a real pain
          Beatie3 Level 1
          Help! *Begins to sink*.
          • 2. Re: ScrollPane a real pain
            Beatie3 Level 1
            O.K. if no one has any thought on the problem of the mysteriously partially inactive scrollpane, would anyone have an idea of how to make an image load into the bottom right corner of the scrollpane, please? If the image could load so the bottom right corner of the image was visible I could cope without the bottom scollbar.
            • 3. Re: ScrollPane a real pain
              Greg Dove Level 4
              I've not used as3 much, but I want to start doing more with as3 so I'll give it a try later today to see if I can a) replicate the problem, b) understand it and c) fix or avoid it.
              If there's any chance you can post a link to a fla that shows the problem happening it might be easier for someone to respond, because doing (a) above will be much much easier - based on your description I sort of understand the nature of the problem but I wonder how easy it might be to replicate and whether there's something else in your context that may also be important.
              If you can get this working, chances are that someone who is more familiar with as3 could respond quicker too.
              • 4. Re: ScrollPane a real pain
                Beatie3 Level 1
                Thank you very much, GWD. Unfortunately we don't have access to a proper testing server atm - I'm using the virtual server with PHP you suggested a while back - but I've uploaded the project files here in a zip file. I've narrowed the problem down to being something to do with the graphics code. The right scollbar is only clickable for about 130 px down and then it goes dead too, but of course if you grab it high enough you can fully scroll vertically, unless you let go of it at the bottom and then you have to use the up arrow to scroll it up again.

                There are three functions at the bottom of the Main.as file that are making it happen, and I don't know why. The images are loaded through the Loading.as, which I've adapted to load the image into the scollpane as well as the scaled loader. I've tried removing the components and creating them dynamically instead of having them sitting in the .fla, but that didn't make any difference either. I've played with the stacking order both in the layers and in the Main.as, putting the scrollpane at different depths, but again the only thing that seems to do is make it disappear. There seem to be quite a lot of people having trouble with the scollpane component and scollbars in AS 3.0, so it may be a bug someone knows about somewhere. Here's hoping.

                After a fairly grueling eight weeks initiation into AS 3.0 I'm starting to understand how it works, but I have yet to find something that makes me see why it's sooooo much better than AS 2.0.

                Thanks again, you are totally a myth among myths!
                • 5. Re: ScrollPane a real pain
                  Greg Dove Level 4
                  I've downloaded it, but won't be able to take a look until late this evening sorry (France time).

                  I've had my own debugging nightmares today, and it was your friendly as2 that was giving me grief (oh and some unfriendly browsers, coupled with the fact that I am unable to replicate and observe the problem myself).

                  So if anyone else wants to tackle this, please go ahead. Otherwise I'll see what I can do in 6 or so hours time from this post.
                  • 6. Re: ScrollPane a real pain
                    Greg Dove Level 4
                    I took a look at it but haven't figured it out yet. But I see it - the problem. I will take a look at it again tomorrow. Like I said, as3 is new to me as well.

                    I would probably start by setting up a scrollpane separately, loading a jpg inside and getting that working as it should... then just repeating your line drawing code which is what the last three functions you mentioned support. If the scrollpane with the image works well without the linedrawing code but fails with it then I would assume its to do with event blocking for the mouse events. Depending what timezone you're in you may want to try that first if you have time (and if no-one else has come up with the answer).
                    • 7. Re: ScrollPane a real pain
                      Beatie3 Level 1
                      Woo hoo! Thank you, GWD, I've sorted it. It was the sprite under the loader. In the loader.as there was a sprite sitting under it, I think they were being strict about adding the loader to a container, but I lost the sprite and just added the loader like this and it all works fine now. Thank you for your time and interest. It always helps to know someone else is offering their support.
                      You're a star!

                      • 8. Re: ScrollPane a real pain
                        Greg Dove Level 4
                        Yay! I'm pleased you found it. See as3 isn't so bad after all.

                        FYI You may want to do this:

                        In your mouseDownHandler:
                        for "dotEnd"
                        instead of:
                        dot.graphics.drawCircle(0, 0, 5);
                        change to:
                        dot.graphics.drawCircle(mouseX, mouseY, 5);

                        then:
                        in enterFrameHandler:
                        add:
                        sprite1.getChildByName("dotEnd").x=(mouseX-startX);

                        and in mouseUpHandler
                        uncomment your line:
                        sprite1.removeChild(sprite1.getChildByName("dotEnd"));

                        that makes the dots work at both ends while drawing the line.


                        • 9. Re: ScrollPane a real pain
                          Beatie3 Level 1
                          That's fabulous, GWD! That dot has been driving me nuts.

                          Now you have to go to Super Star status,
                          :D
                          • 10. Re: ScrollPane a real pain
                            Greg Dove Level 4
                            No problems. I'm just pleased I understood some as3.

                            I'm no super star. Or even a star. I know that because stars are fueled by the fusion of hydrogen atoms. My fuel is caffeine.