9 Replies Latest reply on Jun 27, 2006 1:00 PM by minicat

    Multiple Tell Target Solution ?

    minicat
      Ok, here's the lowdown.

      I've got level 20 loaded with a swf that contains about 50 instances of "bola" mc in the Library. I have things loading onto level25 and I would like all the instances on level 20 to "freeze" or their actions to stop running as they proceed to slow down the site when they are all running at once...so instead of putting in 50 tell target actions I was assuming there could be an easy action referring directly to the mc itself, in which case all the instaces of it, wherever on that level they may be, would in turn repsond accodingly..such as a goto and stop action to a frame with no actions on it... .

      frame one actions:
      x00 = _x;
      y00 = _y;
      MAAI = 2000;


      frame 2 actions:
      x0=_x
      y0=_y
      x=_root._xmouse
      y=_root._ymouse
      a=x-x0
      b=y-y0
      r=Math.sqrt(a*a+b*b)

      quer_fugir_x=this._x-(a/r)*MAAI/r
      quer_fugir_y=this._y-(b/r)*MAAI/r

      quer_voltar_x=(x00-x0)/2
      quer_voltar_y=(y00-y0)/2

      this._x=quer_fugir_x+quer_voltar_x
      this._y=quer_fugir_y+quer_voltar_y


      frame 3 actions:
      gotoAndPlay(2);


      so what's happening is that it becomes too processor heavy when I load this swf onto level 25 which contains even more of these mc's looping and looking for cursor locations. .. and was thinking it woudl be great if when this swf gets loaded onto 25 then this level 20 actions could freeze allowing for a smoother presentation and interaction when level 25 is being viewed...then when we close level 25, we can then "reActivate" these balls on level 20 to continue their interaction. check it out to get a better idea @ www.clearimage.us/temp/cj

      When you enter the site, click on PICS from under the balls there and then choose the furthest LEFT pic to enlarge.. ..the main balls (balls.swf) are the ones loaded onto level 20..and the enlarged pic is loaded onto level 25... . .

      Let me know what you guys think., I'm a victim to not knowing enough outside of a tutorial to get my desired results.. . sniff-sniff :)

      thx in advance !

      jason.z

        • 1. Re: Multiple Tell Target Solution ?
          kglad Adobe Community Professional & MVP
          if you want to stop all the timelines in _levelN you can use:

          • 2. Re: Multiple Tell Target Solution ?
            Rothrock Level 5
            How fun is that! Nice. The way you are scripting the animation is very old school – nothing wrong with that. I'm just wondering if it contributes to slow down. Here is how I tried it out. I just made a clip call "ball" in the library and set its linkage to export for actionscript with the name "ball." Of course it is just a simple gradient. I then attach as many as I need to the stage setting an interval for each one. The intervals could be canceled using a clearInterval(theClip.myInt) and reset whenever needed.

            Really I don't know if this is any better, just different and maybe it will give you some ideas.
            • 3. Re: Multiple Tell Target Solution ?
              Rothrock Level 5
              Whoops. Forgot to attach it.
              • 4. Re: Multiple Tell Target Solution ?
                Jim_Esteban Level 1
                That seems like a neat idea. Do you set different intervals for different balls.
                • 5. Re: Multiple Tell Target Solution ?
                  Rothrock Level 5
                  I didn't for this little experiment, but you certainly could. Or you could cycle through, kill all the original intervals, and assign slightly longer ones to the ones in back. There are lots of ways to go with it.
                  • 6. Re: Multiple Tell Target Solution ?
                    minicat Level 1
                    -- Rothrock.. . nice code..i tried it out on my balls and its neat (that didn't sound so great :). . .but the randomness won't fit my layout as I need to position each ball you see.. . .buUut, it was a good insight into what is possible, thanks for that. I'll see what we can decypher from that... .merci


                    -- kGlad... .I'm going to see how that works now. thx. I'm assuming I can simply apply that to a button on the stage correct ?

                    thanks again guys, I'll try to let you guys know when it's finished.. .
                    • 7. Re: Multiple Tell Target Solution ?
                      Rothrock Level 5
                      minicat – That was just my way of testing. What you could do is place your balls on the stage with names bola0, bola1, etc. Then just change the for loop like sich:

                      for(i=0;i<50;i++){
                      var curClip=this["bola"+i];
                      curClip.x00=curClip._x;
                      curClip.y00=curClip._y;
                      curClip.myInt=setInterval(noodle,80,curClip);
                      }

                      Or whatever you need. That way you can have the visual ease of placing them where you want them in the authoring environment, but still the ease of all the code in one place.

                      And certainly I'm not saying that my way is better. It is just how I would attack the problem.

                      Kglad's code should just be placed on a frame of whatever timeline you need. The first line is how you invoke it, so that part can be separate from the function itself. Also the function isn't defined as a global function so if you put the code in some strange place and the button is buried in a clip inside a clip on another level, etc. you may have trouble with scope.

                      Otherwise something like this should work:

                      myButton.onRelease=function(){
                      //code to start loading the other stuff in to _level25
                      //any other code you want
                      stopAllF(_level20);
                      }
                      • 8. Re: Multiple Tell Target Solution ?
                        junglerat2
                        Hi...hope I'm not offending you by posting this, but I just noticed a grammar mistake and thought you might want to have it pointed out. In Casey Jenning's quote: "If you're giving it your all, fear cannot enter the equation." On your page, note that the first "your" should be "you're."
                        :-)
                        • 9. Re: Multiple Tell Target Solution ?
                          minicat Level 1
                          I'm known for my typos :)..thanks...no offenses taken :) I let other people worry about that stuff :)