Solved

error - A script in this movie is causing Adobe flash player 9 to run slowly etc.

Posted on 2007-03-21
10
7,371 Views
Last Modified: 2008-06-16
I have set up a slideshow gallery script which gets a variable from flashvars from a php page,
and brings it into flash. does some action script and then loops through photos etc.
This works find most of the time, but when i looked at it on my wife's computer I got this error.

Ascript in this movie is causing Adobe Flash Player 9 to run slowly. If it continues to run,
your computer may become unresponsive. Do you wish to abort the script?

what sorts of things should I be looking for to prevent this from happening?
I am not sure of a percentage of people that would recieve this problem, but obviously its not really acceptable for the resulting web design.

any ideas on how to tackle this one?

thanks
Paul
0
Comment
Question by:paulp75
10 Comments
 
LVL 11

Expert Comment

by:sibgig
ID: 18768543
it would be helpful to see the code.
0
 
LVL 23

Assisted Solution

by:Zeffer
Zeffer earned 200 total points
ID: 18768703
any code that creates a loop..while, for, do while, (there's more)..used in conjunction with operator ++ or continue..can send the player into a spin
..but those problems usually show up in test mode..the main thing that can cause the player to slow just playing a swf that has passed muster on the authoring machine is too many onClipEvent events. If there are quite a few the player can start to struggle on slower machines.

Z
0
 
LVL 3

Expert Comment

by:otroligafredde
ID: 18769725
The reason for the alert window popping up is that a single script, (something that happens in one frame)  is taking more than 15 seconds to run. It pops up so that the user wont close the app down thinking that it has crashed. If you could divide up the work, it would solve the problem. Its hard to say anything specific without having seen the code. But try to look at how you load the images.

Cheers

/Fredrik
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 6

Author Comment

by:paulp75
ID: 18775162
thanks for the responses. Sorry i havent had the chance to get back on here, been a very busy day.
here is the code in the fla file actionscript. i'm really happy with how much i've learned about actionscript in this project. so hopefully i can get this working properly on all computers. works great on 2 i've tested it on , and not worked on 2 others. a bit frustrating really. thanks

import mx.transitions.*
/* first create a new instance of the LoadVars object */
var nextX = 0;
/****************create objects**************/
var initThumb:Object = new Object();
myVars = new LoadVars();

// once vars have been loaded, we will populate the gallery:

      myVars.onLoad = function(){
            mcLargePhoto.loadMovie("http://path.to/photos/"+(myVars['photo'+1]));
      for (var i:Number = 1;i <= (myVars.totalphotos) ; i ++){
      initThumb.photo = "http://path.to/photos/"+(myVars['photo'+i]);
makeAThumb(i);
nextX +=140;
            }
      setInterval(_root,"scroller", 50);
      }
initThumb.onRollOver = function(){
thumbFade = new Tween(this, "_alpha", none, 50,100,.5,true);
}
      initThumb.onRollOut = function(){
      thumbFade.yoyo();
      }
      initThumb.onRelease = function(){
            mcLargePhoto.loadMovie(this.photo);
      }
      function makeAThumb(num){
thumbName = myVars['photo'+num];
mcScroller.attachMovie("thumb",thumbName,num,initThumb);
mcScroller[thumbName].mcPhoto.loadMovie("http://path.to/photos/thumbs/"+(myVars['photo'+num]));
mcScroller[thumbName]._x = nextX;
mcScroller[thumbName]._y = 0;
mcScroller[thumbName]._alpha = 50;
}
function scroller(){
      if (this._ymouse>mcScroller._y) {
      var scrollSpeed = (this._xmouse - Stage.width/2)/20;
      if (Match.abs(scrollSpeed) < 1) {
            scrollSpeed =0; }
      mcScroller._x -= scrollSpeed;
      if (mcScroller._x > 0) {
            mcScroller._x = 0;
} else if (mcScroller._x < Stage.width - mcScroller._width){
                                          mcScroller._x = Stage.width - mcScroller._width;
                                          }
}
}
// call the load method to load my php page
myVars.load("http://path.to/getphotos.php?photo_photoset="+_root.photoset);
this.createEmptyMovieClip("mcScroller",this.getNextHighestDepth());
mcScroller._x = 0;
mcScroller._y = 400;


0
 
LVL 3

Accepted Solution

by:
otroligafredde earned 300 total points
ID: 18778101
How many images are we talking about. I think that this for loop:
      for (var i:Number = 1;i <= (myVars.totalphotos) ; i ++){
            initThumb.photo = "http://path.to/photos/"+(myVars['photo'+i]);
      makeAThumb(i);
      nextX +=140;
       }
is the bad guy.

in the makeAThumb function you are attaching the movieclip and then load the image again. Both are processes that take a lot of time. Do you have to load the images this way? Do you have to load them at runtime?

Cheers

/Fredrik
0
 
LVL 3

Expert Comment

by:otroligafredde
ID: 18779300
Sorry, I didnt finish my comment. I meant to say that you could try with fewer images or images that are not so heavy to load. And then try that at the computers were you get errors now.

/Fredrik
0
 
LVL 6

Author Comment

by:paulp75
ID: 18783561
thanks i'm on the right track now. I think i need to change the function so it just used the big pic as a variable instead that it loads on release rather than when i first load the movie.

i will let you know if i can work this one out.
thanks
0
 
LVL 6

Author Comment

by:paulp75
ID: 18784364
wierd. i managed to get the error to stop by moving things around. but now it isnt showing anything at all on some computers. once again works fine on others though.
the most photos that are being used at any one time at the moment is 9. its not a massive amount or anything really.
0
 
LVL 6

Author Comment

by:paulp75
ID: 18784810
finally got it sorted. the problem was that i had the full url to the variables file. so it was http://www.thissite.com/getphotos.php instead of just getphotos.php
once i changed it it did the trick
thanks for all the help though.
much appreciated
0
 

Expert Comment

by:rod21
ID: 21794503
I'm just wondering if anyone can shed light on WHY having the full url to the php file would cause this problem? I'm having a similar problem and am just curious...
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question