This content has been marked as final. Show 19 replies
when you say the web browser freezes do you really mean your animation stutters or do you really mean the animation stops?
The animation stops. In fact, the browser warns me about a script running that never stops, asking me if I want to stop it, but whatever I choose I have to force the application to close, receiving the typical "Application not responding..."
that's a coding (not optimization) problem: you have some coding error(s).
start to debug by checking while-loops or for-loops that are not terminating.
I appreciate your interest, but there is no coding errors. The animation works fine if I got one instance running. The problem comes when I load too many of them at the same time.
kglad's right, you must have some conflicts in the code to get that error. I'm just guessing here, but it may be that you're calling to _root to get a variable for the animation and making adjustments to the variable in the same way. Depending on your method of loading the animations, this might be the problem considering that it runs fine as a single. If you call to the 'ground floor' so to speak, to retrieve a value that is named the same for each instance, it may be causing this problem. can you post the code you are using for the animation.
Can you clarify? Do you mean you are loading 20 instances of a separate swf into a single parent or by different "instances" do you mean completely separately embedded flash objects in the html.
If its the latter (kinda sounds like it) then perhaps its something else (It may be not a sensible thing to do - I would try to avoid doing things that way if its posible). I've never embedded 20 separate flash objects on the same web page so I couldn't say. If I absolutely had to make this work...then I'd be checking a) make sure you have completely unique object id attribute or name for the embed tags and b) Do all the instances try to use ExternalInterface or something unusual like that? i.e. perhaps the problem is outside flash. Beyond that.... I have no more ideas.
umm, you want to bet about a coding error?
i'll bet i can get your application to run without freezing and without that warning and still load all 20 of your animations.
Sorry Kglad, I didn't mean to be rude. With "No coding errors" I meant the animation itself runs with no errors. I'm sure you could run the 20 instances with no freezing (that's why I put the post :) ) But I'm affraid it is an animation for a client, so I cannot distribute the code.
Perhaps I didnt explain the situation clearly enough (in part because of my poor english...).-
- By 20 instances I mean 20 separated embedded objects in the html
- The animation is relatively simple. A turned on candle, in each cycle I calculate the next position of the flame (that oscilates from left to right). The flame is composed by 4 concentric gradients. There is NO loops, only an 'onEnterFrame' function refreshing the flame each time.
- It's true that I got plenty variables at the _root level. If that could be the problem, how can I workaround it?
- It is my first time trying to embed so many objects at the same time too. No idea if the problem could be the way I embed the object from the html :(
- The only thing I can guess is that when a cycle of one of the object is running, the other 19 objects must wait their turn. That would explain why the more instances I run, the worst results I get. In that case, I wonder if there's a way to run them in a kind of asynchronous mode, just guessing...
Any other comment would be appreciated. Anyway, thanks a lot everybody for your colaboration.
It also might be the lack of unique IDs on the embedding if the scenario I described above applies.
I just did a quick search and there have been historic issues with earlier players, so it may be an older player as well:
Yyyeah : just saw your reply: what embedding method are you using and do they all have unique IDs in the object tags for example?
I've just looked GWD. I'm not too experienced embedding flash in html :(, I use the code that flash generates when I publish the movie, something like this
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="200" height="500" id="VelaFinal" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="VelaFinal.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /> <embed src="VelaFinal.swf" quality="high" bgcolor="#000000" width="200" height="500" name="VelaFinal" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />
Basicly, I copy/paste it till reach 20 (not too sofisticated, I guess...) So, if I got to change any Id, you're right, they're all the same... but not sure if you mean classid or id
No, not classid that needs to be the same. Each object tag needs a unique id attribute id="movie1" and then id="movie2" etc. Or in your case id="VelaFinal", id="VelaFinal2", id="VelaFinal3" etc
And you need to match that in the embed tags for the name attribute
You should also be aware that just placing these tags in the page like that means a couple of things - a) the page is not valid xhtml - in case your client requires that and b) Internet explorer will have the click-to-activate behaviour.
Ok, I tried with unique ids getting the same results :(
I'll give it a try with some of those methods to load the script. Thank you very much!
It still could be exactly what kglad said. If you have a code error in each clip that is consuming memory. But you would need to post your code to get that fixed here and it seems you can't do that.
I'm affraid not. Anyway, at first I could only load less than 10 instances. I tried to simplify the animation (at first there were up to 5 gradients refreshing every frame, and when I erased 2 of them I could run up to 14 instances) Could it be the gradients that are consuming that memory?
Its pretty hard to answer that without seeing your code. Animating multiple gradients shouldn't continuously grow memory use if the number remains constant, but it might give your CPU a workout with that many 'players'- depending on your system specs and what the animation is doing (multiple gradients with alpha etc). If you're using windows just take a look at whats happening to memory and CPU usage for your browser in the process tab.
I've got nothing left sorry. Beyond that kglad has the bet running and is obviously keen to review your code... and... unless you have some old player in your browser that's causing the problem... then I think he would win the bet. ;)
why are you embedding more than 1 swf in your html page?