5 Replies Latest reply on Nov 28, 2006 12:00 AM by ScottyDawg


    roozbeh_fir Level 1
      I have a main.swf file that a child.swf nests inside by clicking a button. the child.swf contains some actionscripts which is running all the time. i want to stop all actionscript functions in child.swf and restart it by clicking a button that exists inside the main.swf. Is there any code to stop a nested actionscript functioning?
      Note: the child.swf actionscipts run without any need of mouse triggers. they just run when the nested movie loads.
        • 1. Re: STOP ACTIONSCRIPT!
          cosu Level 1
          the nested child loads on a certain level (eg: _level1). from main movie use:

          • 2. Re: STOP ACTIONSCRIPT!
            roozbeh_fir Level 1
            thanks for your attention. but it didn't work because it only works with MovieClip that hosts swf file not with nested swf file itself. Yes it makes MC stop. but it's already stopped cuz there's only one frame inside that MC. I think i need a code to works with inside of nested swf file.
            • 3. Re: STOP ACTIONSCRIPT!
              ggshow Level 2
              please show us ur script in child.swf
              and the script u use to load child.swf into main.swf

              let say if you load your child.swf into level1,
              and you are using onEnterFrame to run the script in child.swf
              then you can use script below to stop the script:

              delete _level1._onEnterFrame;
              • 4. Re: STOP ACTIONSCRIPT!
                roozbeh_fir Level 1
                here's the code i use in main.swf to load child.swf:

                on (release) {

                here's the code that exist inside of child.swf, It's all about a image slider:

                anchoPelicula = 613;
                altoPelicula = 80;
                acel = 15;
                iniciado = true;
                // Operaciones
                acel /= 40;
                panoramica_mc._y = 0;
                panoramica2_mc._y = 0;
                mitad = anchoPelicula/2;
                ancho = panoramica_mc._width;
                panoramica_mc._x = 0;
                panoramica2_mc._x = (0-ancho);

                // Al pasar el mouse encima

                fondo_mc.onRollOver = function() {
                iniciado = false;

                fondo_mc.onRollOut = function() {
                //delete panoramica_mc.onEnterFrame;

                // Funcion Mover
                function mover() {
                panoramica_mc.onEnterFrame = function() {
                //trace("grandao dando role em: "+ _root.panoramica_mc._x);
                if (_xmouse != mitad) {
                if (_xmouse<mitad && _ymouse < 147 && _ymouse>0) {
                if(panoramica_mc._x < 0) {
                inc = Math.abs(_xmouse-mitad)*(acel/10);
                panoramica_mc._x += inc;

                } else {
                inc = Math.abs(_xmouse-mitad)*(acel/10);
                if (panoramica_mc._x>(-3780.4) && _ymouse < 147 && _ymouse>0) {

                panoramica_mc._x -= inc;


                function init() {
                this.onEnterFrame = function() {
                if (iniciado) {
                if (panoramica_mc._x>(-3780.4)) {
                panoramica_mc._x -= 1.8;
                delete this.onEnterFrame;

                maior = _root.panoramica_mc._width;
                menor = _root.slider._width;
                desl = maior - Stage.width +20;

                var prop = desl / menor;

                function anda(obj, lugar){
                //trace("movendo " + obj._name + " para " + parseInt(lugar));
                obj._x = lugar;

                function barraqueanda() {
                _root.slider.bar.onEnterFrame = function() {
                this._x = (_root.panoramica_mc._x / 5.5) *-1;

                The images slides left or right based on mouse move, and i want to stop this sliding by clicking a button in main.swf.
                • 5. Re: STOP ACTIONSCRIPT!
                  You'll need to build the ability to stop the image slider into the code that controls it, then call that code from your parent swf. For example, create an enabled variable in your child.swf, and nest the script that does the moving within a conditional that checks the value of enabled. Your parent.swf can switch the enabled value on and off.

                  If this is part of a larger, more complex system, you'd really want to structure all of this functionality within AS classes to tighten up the interplay between elements.