Solved

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

Posted on 2007-03-21
10
7,354 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now