Solved

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

Posted on 2007-03-21
10
7,377 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

830 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