17 Replies Latest reply on Feb 20, 2008 7:11 AM by kglad

    big problem with Tween

    peor Level 1
      I have a problem with this subsections:

      _root.createEmptyMovieClip("begin05", this.getNextHighestDepth());
      var text04:MovieClip = _root.begin05.createTextField("text04_txt", this.getNextHighestDepth(), 125, 620, 650, 100);
      var endtext05:Tween = new Tween(text04, "_y", Strong.easeOut, Stage.height+100, 620, 6, true);
      endtext05.onMotionFinished = function() {
      _root.begin05.onPress = function () {
      var black1:MovieClip = _root.attachMovie("blackbg", "black", _root.getNextHighestDepth(), {_x:0, _y:0});
      var black2:Tween = new Tween(black1, "_alpha", None.easeNone, 0, 100, 3, true);
      black2.onMotionFinished = function() {
      gotoAndStop("Scene 2", 1);
      };
      };
      };

      when I click so tween this out as black color and after so stop this and the don't go to Scene 2.
      Can someone help to correct this so I can get Scene number two of three scenes.
      I'm beginner of actionscript and programmering. So please help me.

      Here is whole of the first script (Scene 1):

      import flash.filters.DropShadowFilter;
      import mx.transitions.Tween;
      import mx.transitions.easing.*;

      var black1:MovieClip = _root.attachMovie("blackbg", "black", this.getNextHighestDepth(), {_x:0, _y:0});
      new Tween(black1, "_alpha", None.easeNone, 100, 0, 3, true);
      stop();
      _root.attachMovie("bg", "a", this.getNextHighestDepth(), {_x:0, _y:0});
      var text01:MovieClip = this.createTextField("text01_txt", this.getNextHighestDepth(), (Stage.width-250)/2, 5, 250, 100);
      new Tween(text01, "_x", Elastic.easeOut, Stage.width, (Stage.width-250)/2, 3, true);
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 30;
      text01_txt.text = "Välkommen hit!!!";
      text01_txt.setTextFormat(my_fmt);
      text01_txt.setTextFormat(my_fmt);
      text01_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = text01_txt.filters;
      myFilters.push(myDropFilter);
      text01_txt.filters = myFilters;

      var text02:MovieClip = this.createTextField("text02_txt", this.getNextHighestDepth(), 50, 50, 300, 80);
      new Tween(text02, "_alpha", Strong.easeOut, 0, 100, 80, true);
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 25;
      text02_txt.text = "Karta över Svågadalen";
      text02_txt.setTextFormat(my_fmt);
      text02_txt.setTextFormat(my_fmt);
      text02_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = text02_txt.filters;
      myFilters.push(myDropFilter);
      text02_txt.filters = myFilters;

      var text03:MovieClip = this.createTextField("text03_txt", this.getNextHighestDepth(), 0, 600, 650, 100);
      new Tween(text03, "_x", Strong.easeOut, -650, 0, 6, true);
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 18;
      text03_txt.text = "Här kan du få se bilder på Gröntjärn, Hornberget och Svågadalen.\nKlicka på länken";
      text03_txt.setTextFormat(my_fmt);
      text03_txt.setTextFormat(my_fmt);
      text03_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = text03_txt.filters;
      myFilters.push(myDropFilter);
      text03_txt.filters = myFilters;

      _root.createEmptyMovieClip("begin05", this.getNextHighestDepth());
      var text04:MovieClip = _root.begin05.createTextField("text04_txt", this.getNextHighestDepth(), 125, 620, 650, 100);
      var endtext05:Tween = new Tween(text04, "_y", Strong.easeOut, Stage.height+100, 620, 6, true);
      endtext05.onMotionFinished = function() {
      _root.begin05.onPress = function () {
      var black1:MovieClip = _root.attachMovie("blackbg", "black", _root.getNextHighestDepth(), {_x:0, _y:0});
      var black2:Tween = new Tween(black1, "_alpha", None.easeNone, 0, 100, 3, true);
      black2.onMotionFinished = function() {
      gotoAndStop("Scene 2", 1);
      };
      };
      };
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 18;
      _root.begin05.text04_txt.text = ".::Svågadalen::.";
      _root.begin05.text04_txt.setTextFormat(my_fmt);
      _root.begin05.text04_txt.setTextFormat(my_fmt);
      _root.begin05.text04_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = _root.begin05.text04_txt.filters;
      myFilters.push(myDropFilter);
      _root.begin05.text04_txt.filters = myFilters;

      var text05:MovieClip = this.createTextField("text05_txt", this.getNextHighestDepth(), 450, 650, 650, 100);
      new Tween(text05, "_y", Strong.easeOut, Stage.height+100, 650, 6, true);
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 18;
      text05_txt.text = "Gör även ett besök på Svågadalens hemsida:";
      text05_txt.setTextFormat(my_fmt);
      text05_txt.setTextFormat(my_fmt);
      text05_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = text05_txt.filters;
      myFilters.push(myDropFilter);
      text05_txt.filters = myFilters;

      _root.createEmptyMovieClip("begin06", this.getNextHighestDepth());
      var text06:MovieClip = _root.begin06.createTextField("text06_txt", this.getNextHighestDepth(), 775, 650, 150, 100);
      var endtext06:Tween = new Tween(text06, "_x", Strong.easeOut, Stage.width+150, 775, 6, true);
      endtext06.onMotionFinished = function() {
      _root.begin06.onPress = function () {
      getURL(" http://www.google.com", "_blank");
      };
      };
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "_serif";
      my_fmt.size = 18;
      _root.begin06.text06_txt.text = "svagan.se";
      _root.begin06.text06_txt.setTextFormat(my_fmt);
      _root.begin06.text06_txt.setTextFormat(my_fmt);
      _root.begin06.text06_txt.selectable = false;
      var myDropFilter = new DropShadowFilter();
      myDropFilter.blurX = 25;
      myDropFilter.blurY = 10;
      myDropFilter.angle = 180;
      myDropFilter.inner = true;
      myDropFilter.alpha = 100;
      myDropFilter.color = 0x0FFF80;
      var myFilters:Array = _root.begin06.text06_txt.filters;
      myFilters.push(myDropFilter);
      _root.begin06.text06_txt.filters = myFilters;

      var karta11:MovieClip = _root.attachMovie("map11", "karta1", _root.getNextHighestDepth(), {_x:40, _y:150, _width:218, _height:360});
      new Tween(karta11, "_x", None.easeNone, Stage.width, 0-218, 3, true);
      var start1:Tween = new Tween(karta11, "_alpha", None.easeNone, 100, 0, 3, true);
      start1.onMotionFinished = function() {
      start2();
      };
      function start2(karta22:MovieClip):Void {
      var karta22:MovieClip = _root.attachMovie("map22", "karta2", _root.getNextHighestDepth(), {_x:40, _y:150});
      new Tween(karta22, "_x", None.easeNone, Stage.width, 371, 6, true);
      var start22:Tween = new Tween(karta22, "_alpha", None.easeNone, 50, 100, 6, true);
      start22.onMotionFinished = function() {
      new Tween(karta22, "_x", None.easeNone, 371, 371, 12, true)
      new Tween(karta22, "_alpha", None.easeNone, 100, 0, 6, true);
      start3();
      };
      };
      function start3(karta33:MovieClip):Void {
      var karta33:MovieClip = _root.attachMovie("map33", "karta3", this.getNextHighestDepth(), {_x:40, _y:80});
      new Tween(karta33, "_x", None.easeNone, Stage.width, 0+45, 6, true);
      var start33:Tween = new Tween(karta33, "_alpha", None.easeNone, 50, 100, 6, true);
      start33.onMotionFinished = function() {
      new Tween(karta33, "_x", None.easeNone, 45, 45, 12, true)
      new Tween(karta33, "_alpha", None.easeNone, 100, 0, 6, true);
      start4();
      };
      };
      function start4(karta44:MovieClip):Void {
      var karta44:MovieClip = _root.attachMovie("map44", "karta4", this.getNextHighestDepth(), {_x:40, _y:80});
      new Tween(karta44, "_x", None.easeNone, Stage.width, 0+55, 12, true);
      new Tween(karta44, "_alpha", None.easeNone, 50, 100, 6, true);

      };
        • 1. Re: big problem with Tween
          kglad Adobe Community Professional & MVP
          don't use scene information to navigate and don't use the goto functions. label your frames and use those labels in the goto methods:
          • 2. Re: big problem with Tween
            kglad Adobe Community Professional & MVP
            p.s. use the attach code option to display code in this forum.
            • 3. Re: big problem with Tween
              peor Level 1
              You can go in to Problem with ActionScript and forgot download for scene.fla to see which problem I have.
              • 4. Re: big problem with Tween
                kglad Adobe Community Professional & MVP
                if that code doesn't work it's because you don't have a frame labelled or it's not the _root timeline that you want to control.
                • 5. Re: big problem with Tween
                  peor Level 1
                  okay kglad. This code gotoAndPlay("scene2"); works without Tween class but when I use with Tween class so can't I open next Scene 2. Why it's so. Do want to open 1scene.fla and correct the actionscript so I can open Scene 2.

                  I have also problem with album.fla ( albumScroll.as).
                  When I'm in album and click (onPress - event handler) a small image so (tween) this up on screen but the handcursor don't close.
                  If I click so shall hand cursor disappear and the bigger image came up and when I click on bigger image this go down.
                  when I'm within bigger image and click blue button in upper-left corner so show map and when I click again so is map disappear.
                  This don't works because I use event handler in the movieclip and how can I make these.
                  When I click on small image and the bigger image came up so I want background with album (instance name = image_mc - in library = album_mc) plus slider scroll (in library = scrollnew) are lock when
                  the bigger cames up but this not happened here but now I have tween alpha background (in library = bg_album) and why delay this.
                  scrollnew and bg_album I use attachMovie.
                  I saw and read from the site "protect a movie from changing depth?" how I can lock movieclip but I don't understood that.
                  I don't how these codes use and works.
                  • 6. Re: big problem with Tween
                    kglad Adobe Community Professional & MVP
                    how do you press on _level0.begin05 when there's nothing visible on-stage?

                    and i don't understand your 2nd issue.
                    • 7. Re: big problem with Tween
                      peor Level 1
                      kglad "how do you press on _level0.begin05 when there's nothing visible on-stage? and i don't understand your 2nd issue." I don't understand what you mean and can you explain me more. Please correct 1scene.fla and album.fla files to me. I'm beginner within ActionScript 2.0
                      • 8. Re: big problem with Tween
                        kglad Adobe Community Professional & MVP
                        well, you create begin05 using the createEmptyMovieClip() method. so there's no content, yet. then you create a textfield in begin05, but the textfield have no text, no border and no background defined so nothing will show on-stage with that.

                        then you define your begin05 mouse handler. i can't feature there's anything to press.
                        • 9. Re: big problem with Tween
                          peor Level 1
                          How shall I use a textfield with event handler in actionscript. I want use a link here to scene 2.
                          I have took this _root tips with textfield from site.
                          • 10. Re: big problem with Tween
                            kglad Adobe Community Professional & MVP
                            just like you're doing. but you need to give your textfield some content so it can respond to mouse events.
                            • 11. Re: big problem with Tween
                              peor Level 1
                              Okay but can you give me a example about this "give your textfield some content so it can respond to mouse events".
                              • 12. Re: big problem with Tween
                                peor Level 1
                                What I mean in who you "and i don't understand your 2nd issue." are I want don't touch or move with mouse event in background but now can I touch this. How can I freeze so I can't still movement album_mc. Do you understand me now? Why don't send you fla files to me. I can pay you with money on my internet bank if you send me correct fla files.

                                // "and i don't understand your 2nd issue."

                                I have also problem with album.fla (albumScroll.as).
                                When I'm in album and click (onPress - event handler) a small image so (tween) this up on screen but the handcursor don't close.
                                If I click so shall hand cursor disappear and the bigger image came up and when I click on bigger image this go down.
                                when I'm within bigger image and click blue button in upper-left corner so show map and when I click again so is map disappear.
                                This don't works because I use event handler in the movieclip and how can I make these.
                                When I click on small image and the bigger image came up so I want background with album (instance name = image_mc - in library = album_mc) plus slider scroll (in library = scrollnew) are lock when
                                the bigger cames up but this not happened here but now I have tween alpha background (in library = bg_album) and why delay this.
                                scrollnew and bg_album I use attachMovie.
                                I saw and read from the site "protect a movie from changing depth?" how I can lock movieclip but I don't understood that.

                                //
                                • 13. Re: big problem with Tween
                                  kglad Adobe Community Professional & MVP
                                  i'm very sorry but there's a significant language problem that makes it difficult to understand your meaning.

                                  here's an example of how to make your movieclip visible (if Stage.height>640):

                                  • 14. Re: big problem with Tween
                                    peor Level 1
                                    You don't understand how I described you. I have maybe describe bad for you. Here is my last and short description about even handler. I want use createTextField with text as in turn have tween motion and later onPress event handler when the Tween motion is end.
                                    • 15. Re: big problem with Tween
                                      kglad Adobe Community Professional & MVP
                                      use the code i gave in my previous message and add your onPress handler in the onMotionFinished function.
                                      • 16. Re: big problem with Tween
                                        peor Level 1
                                        okay and thank you so very much for you want to help me.
                                        • 17. Re: big problem with Tween
                                          kglad Adobe Community Professional & MVP
                                          you're welcome.