Solved

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

Posted on 2007-03-21
10
7,386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 11

Expert Comment

by:Tom Ray
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

732 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