preloading images 2004-03-17 - By Adrian McTaggart
Back I have a card game that is 175k in size. There are 20 images used for the cards , each between 2.5 and 4k. These are being loaded in from the server when required into an mc that is in the card. The code used is:
-- ---- -- playerImageHolder.loadMovie("images/image"+[_root.pcc]+".jpg"); playerImageHolder._y = 0;
playerImageHolder.onEnterFrame = function() { var howLoaded = getBytesLoaded(); var totalLoaded = getBytesTotal(); if (isNaN(totalLoaded) || totalLoaded<4) { return; } if (howLoaded == totalLoaded) { playerImageHolder._width = 176; playerImageHolder._height = 120; delete this.onEnterFrame; } } -- ---- --
In the first line '_root.pcc' will be a number from 1-20. The images are named image1.jpg, image2.jpg etc.
The whole game is preloaded using a separate preloader swf. It works fine over broadband and the images are there when each card turns over. However on dial up there is a 1 or 2 second delay before the card image appears, even if the image has already been downloaded once.
The images are on a frame that is not active until the card is turned and .
What is the best approach to ensure that there is no delay in the images appearing? Do
TIA,
A
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|