all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

Loaded image keeps flickering


Re: Loaded image keeps flickering tralfaz
10/16/2005 5:46:08 PM
flash actionscript:
[quoted text, click to view]

The way your code is written you could end up with thousands of copies
of setInterval running. Eventually your computer will bog down from
the overload. Make sure you do not call setInterval on every pass
through frame 2.
tralfaz

Loaded image keeps flickering jls33fsls
10/16/2005 6:49:29 PM
If you visit http://allvolume.com/poker/load_stuff.swf, after 3 seconds an
image of a card will show up and the html that is being parsed to display that
image will show to the right of it. This image is being pulled from the
database, and I am using setInterval to check the database every 3 seconds for
a new card, but everytime it checks the database for a new card the card image
flashes.

Frame 1:
card1b = "<img src='http://allvolume.com/poker/images/cards/default/";
card1b += card1;
card1b += ".jpg' width='100' height='159'>";
gotoAndPlay(2);
stop();

Frame 2:
function load_vars() {
loadVariablesNum("load_stuff.php?id=yours", 0, "POST");
gotoAndPlay(1);
}
setInterval(load_vars, 3000);
stop();

I am guessing that the problem is that I am loading the image over and over
even if it doesn't need to be changed, but I can't seem to find a way to only
update it if it has changed since you can't call the loaded variables on the
same frame they were called (correct me if I am wrong, but that is the
conclusion I have come to from the work I have put into trying to get this to
work).
Re: Loaded image keeps flickering jls33fsls
10/17/2005 12:34:22 AM
Okay I finally found the solution. Instead of loading it as html I used a
Loader component to load the image into the swf and then I checked to see if it
was a new image and if it wasn't I didn't reload the image in. The main
problem was that it flickered between frames because it had to reload the html,
but this solves that issue since the image becomes an object.
AddThis Social Bookmark Button