Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




JPEG Viewer With Preloader



I want to make a JPEG viewer in flash, with a preloader.
First a bunch of thumbnails is displayed on the stage and when a user clicks on it, it opens the large picture. I would like to have a preloader that preloads the thumbnails and the large picture when clicked on.
I already have build a preloader movie clip, for the swf, and would like to use this one for the jpeg's also. The preloader needs the following two variables to function: iBytesTotal and iBytesLoaded. At 100% it triggers a code.

I was trying to accomplisch this with a FOR loop that loads the thumbnails on the stage. And the loadClip function to load the actual image. I know that the loadClip has the ability to put a listener to it, so I can get the bytesloaded, while loading, on error events, on load events, etc... But how do I implement this in actionscript ??

Here is an example of what I want to accieve:

for (i=1;i<=20;i++){Show the preloader, and when the load is complete display the image
The next image is displayed right next to the other image (_x = thumbnail.width * i)
}



FlashKit > Flash Help > Flash MX
Posted on: 09-03-2005, 01:20 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

JPEG Decoder (viewer) - Optimization
Intro
I write this as both a very simplistic guide to the creation of a JPEG decoder in flash and a request for help. My preemptive apologies if this is somewhat leech-like - hopefully others will be able to use the class (it averts the memory-leak exhibited by the Loader object).

Background
I wrote this class to try and avoid, as I previously mentioned, the memory-leak exhibited by the Loader object. It works exclusively with JPEG images atm and currently only those exported-for-web through photoshop (with quality = 90). The latter limitations do not concern me, I'm quite capable of circumventing them.

Unfortunately however, the majority of JPEG viewers use optimized iDCT algorithms which I've not yet being able to implement.

Optimization (Request for help)
The class loads an image very slowly this is due to two functions:jpgImgDecodeScanData - I believe the delay caused by this procedure to be due to the manner in which it searches for codes in the scan data and compares them to huffman tables. Currently it iterates through the huffman entires, (in ascending order), until it locates a valid code.
idct - this requires an optimized algorithm.
Any input would be greatly appreciated.

License
Reuse of the provide code is more than welcomed under the GNU license.

Pertinent Code

Code:
private function jpgImgDecodeScanData():Boolean
{
var tabInd:int = 0;
var dc:Boolean = true;
var type:String = 'L';
var ind:int = 0;
var indMCU:int = 0;
var htInd:Array;
var val:int;
imgMCU = new Array();

// process scan data
for (var k:int = 0;k < imgSCAN.length; k++)
{
var code:int = -1;
var strByt:String;

// find code
for (var i:int = 0;i < imgDT[tabInd]["code"].length; i++)
{
// validate
if (imgDT[tabInd]["code"][i].length > 0)
{
// generate string
strByt = imgSCAN.substr(ind, i+1);
//trace("ind: " + ind + ' - len: ' + (i+1) + ' txt: ' + strByt);

// check against codes
for (var j:int = 0; j < imgDT[tabInd]["code"][i].length; j++)
{
if (strByt == imgDT[tabInd]["code"][i][j])
{
code = Number(imgDT[tabInd]["bit"][i][j]);
//trace(code + "' = '" + strByt + "'");
break;
}
}

// completion
if (code >= 0) break;
}
}

// completion
if (code < 0)
{
//trigEvent(customEvent.ERROR, customEvent.ERR_IMG_MISC, 'invalid scan segment');
//return false;
return true;
}

// advance
ind += strByt.length;

// process based on type
if (dc)
{
// dc-value
// initialize mcu
if (imgMCU[indMCU] == null) imgMCU[indMCU] = new Array();
imgMCU[indMCU][type] = new Array();
imgMCU[indMCU][type]['dat'] = new Array();

// retrieve value
val = Number(procedures.bas2bas(imgSCAN.substr(ind, code), 10, 2));

// decode dc value
if (val < Math.pow(2, code)/2) val = ((Math.pow(2, code) - 1) - val) * -1;
if (indMCU > 0) val += imgMCU[indMCU-1][type]['dat'][0];
imgMCU[indMCU][type]['dat'][0] = val;
//trace('DC for ' + type + ' = ' + val);

// update status
if (type=='L') tabInd = 2; else tabInd = 3;
htInd = new Array();
dc = false;

// advance position
ind += code;
} else {
// ac-value
// record ac value
var indAC:int = imgMCU[indMCU][type]['dat'].length;
var strNib:String = procedures.bytPad(procedures.bas2bas(String(code)));
var zrl:int = Number(procedures.bas2bas(strNib.substr(0, 4), 10, 2));
var readLen:int = Number(procedures.bas2bas(strNib.substr(4, 4), 10, 2));
var strVal:String = imgSCAN.substr(ind, readLen);

// determine value
val = Number(procedures.bas2bas(strVal, 10, 2));
if (strVal.charAt(0) == '0') val = (Math.pow(2, strVal.length) - 1) * -1 + val;

//trace('readLen: ' + readLen + ', zrl: ' + zrl + ', val: ' + val);
if (indAC==0) trace("key: " + type + ',val: ' + val);

// propagate zero run-length
for (var q:int=0;q<zrl;q++)
{
imgMCU[indMCU][type]['dat'][indAC++] = '0';
}

// retrieve nibbles (RLC)
imgMCU[indMCU][type]['dat'][indAC] = val;
//trace("compiled byte: " + strNib + ", category: " + cat + ", category code: " + catCode);

// mcu completion
if (code == 0 || indAC == 63)
{
//trace("found EOB");
// update status
dc = true;
if (type=='L' || type == 'B')
{
if (type == 'L') type = 'B'; else type = 'R';
tabInd = 1;
} else {
// new mcu
indMCU++;
type = 'L';
tabInd = 0;
}
}

// advance position
ind += readLen;
}
}

return true;
}



private function idct(dat:Array):Array {
var u,v,xx,yy:int;
var temp:Array = new Array();
for (xx=0; xx<8; xx++) {
temp[xx] = new Array();
for (yy=0; yy<8; yy++) {
temp[xx][yy] = 0;
for (u=0; u<8; u++) {
for (v=0; v<8; v++) {
if (dat[u*8+v]==null) dat[u*8+v] = 0;
var val:Number = dat[u*8+v] * Math.cos((2*xx+1)*u*Math.PI/16.0) * Math.cos((2*yy+1)*v*Math.PI/16.0);
if (u==0) val *= .7071;
if (v==0) val *= .7071;
temp[xx][yy] += val;
}
}
}
}

for (xx=0; xx<8; xx++) {
for (yy=0; yy<8; yy++) {
dat[xx*8+yy] = Math.floor(temp[xx][yy] / 4 + 0.5);
}
}

return dat;
}
Useful Links
These are probably more helpful for those looking to develop their own JPEG viewer / encoder (the latter of which has already been achieved).
ImperialViolet Haskell Sample Code / Tutorial
ImpulseAdventure - JPEG huffman Coding tutorial

Sample Image
Please find sample images attached below.

Once again help, however minimal, is greatly appreciated

2 Questions Preloader + Image Viewer
Im havin problems wit my preloader! it seems to just keep loading. i had it working before but it still loaded 1 and a half times! can u please look at my code and show me where i gone wrong.

Code:
onClipEvent (load) {
total = _root.getBytesTotal("scene2");
}
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded("scene2");
percent = int(loaded / total * 100);
text = percent + "%";
gotoAndStop("percent");
if (loaded == total) {
_root.gotoAndPlay("scene2");
}
}
ALSO

having a prob with the default photo album template built into flash mx 04
it works fine but if i add my preloader it seems to add this as a pic e.g says i got a total of 6 pics and i have 5, this means that people can also click prev pic and go back to the preloader p.s this is on scene 2! preloader is on scene 1!

Code:
function updateFrame (inc) {
// send slides to new frame
newFrame = _root._currentFrame + inc;
_root.gotoAndStop(newFrame);

updateStatus();

if (_root._currentFrame == 1) {
prevBtn.gotoAndStop(2);
} else {
prevBtn.gotoAndStop(1);
}
if (_root._currentFrame == _root._totalFrames) {
nextBtn.gotoAndStop(2);
} else {
nextBtn.gotoAndStop(1);
}
}

function updateStatus () {
_root.statusField = _root._currentFrame + " of " + _root._totalFrames;
}

function autoplayInit () {
startTime = getTimer();
hideControls();
updateStatus();
}

function autoplay () {
if (autoplayStatus != 0) {
// get the current time and elapsed time
curTime = getTimer();
elapsedTime = curTime-startTime;

// update timer indicator
indicatorFrame = int(4/(delay/(elapsedTime/1000)));
indicator.gotoAndStop(indicatorFrame+1);

// if delay time if met, goto next photo
if (elapsedTime >= (delay*1000)) {
if (_root._currentframe == _root._totalframes) {
_root.gotoAndStop(1);
} else {
_root.nextFrame();
}
autoplayInit();
}
}
}

function hideControls () {
nextBtn.gotoAndStop(1);
prevBtn.gotoAndStop(1);
}

updateFrame();
autoplayStatus = 0;

One Flash Banner Plays Differently When Viewer First Visit The Site And When Viewer N
I have a flash banner at the top, when the viewers first come to my site, my flash banner plays the way I want, when viewers start to navigate my site and got redirected to other pages within my site, the flash banner on the top will paly the same way as the page loaded at the first time, this is kind of annoying, I would like the flash to play once especially the flying buttons, when the visitor trying to buy something on my site, the flash should stay still, don't play the action again and again on every page, How do I do that?
you can see my example at http://leafshoppingcart.viperhosting.net/xcart/
Thanks in advance

Jpeg Preloader...
I'm trying to get this script to work that loads a jpeg into a container mc and waits for it to be fully loaded before before it fades in onto the screen. It seems to work fine on my computer, but it won't work on the server that I have to post it on. Any ideas as to why? Thanks, I got a lot of this script from an earlier post about preloaders,


PHP Code:




function loadSlide()
{
    //trace("loading slide #" + i+1);
    _root.slideNum.text = "Slide " + (_root.i+1) + " of " + slidesArray.length;
    _root.imgCaption.txt.text = slidesArray[_root.i].attributes.caption;
    _root.imgTitle.txt.text = slidesArray[_root.i].attributes.title;
    _root.img.holder.loadMovie(slidesArray[_root.i].attributes.img);
    
    //This code is will preload the image before it slides onto the screen
    _root.createEmptyMovieClip("preloadMC", 1);
    _root.preloadMC.onEnterFrame = function() {
        bl = _root.img.holder.getBytesLoaded();
        bt = _root.img.holder.getBytesTotal();
        //first it detects the file
        if (bt > 0) {
            _root.percent.text = Math.round(bl / bt * 100) + " percent";
            //check if it's loaded
            if (bl >= bt) {
                //done
                _root.percent.text = "loaded successfully";
                _root.gotoAndStop(2);
                delete this.onEnterFrame;
            }//end if
        }//end if bt>0
        else {
            _root.percent.text = "error, couldn't load file";
        }//end else
        
    }//end fucntion method_mc.onEnterFrame()
}//end function loadSlide()

Jpeg Preloader
Can any one help Im trying to make a preloader to show when images are ready to view similar to this site
http://www.rui-camilo.de/

Not the first preloader but the second.

What happens is that when you click on a section a flashing icon shows that the image is loading for each image.

Any advice or tutorials you have seen.

Preloader For A Jpeg
Is a external .swf with a loading bar and percent -
I just need a preloader that when it finish the load goes to frame 2 - i was searching arround and i only found that goes to the next scene.

And when i put it in the main.swf - the preloader works but instead of show the jpg, it goes to the next frame on the main movie.

any help?

Preloader For JPEG?
The following example loads a JPEG image from the same directory as the SWF file that calls the loadMovie() function:

loadMovie("image45.jpeg", "ourMovieClip");


How can i use preloader for this JPEG?

Thanks

JPEG Preloader Help
Hi All,

Earlier yesterday, I ran into a jpeg preloader that looked good. Although i was having problems getting it to run properly! It loads the movie, but does NOT show the preloader. The loaded should fade in, continually rotate, then fade out on load.
anyone see anything?

(sorry to origional poster of this code, forgot to bookmark)

Code:
loadClip = function () {
circle.onEnterFrame = function() {
_root.targetClip.loadMovie("myjpeg.jpg");
this._rotation += 20;
if (targetClip.getBytesLoaded()<targetClip.getBytesTotal()) {
if (this._alpha<100) {
this._alpha += 5;
}
} else {
if (this._alpha>0) {
this._alpha -= 5;
targetClip._alpha += 5;
} else {
delete this.onEnterFrame;
}
}
};
};
loadClip();
thanks in adavence!
jamie

JPEG Preloader?
What would be the best way to pause a movie for the loading of a JPEG image? All the preloaders seem to wait for movie bytes to load, but not external JPEGS.

Jpeg Preloader?
Hi all,

may I know if there is some existing source for jpeg preloader?
basically, I want to load a jpeg into a movie clip... and would like to have a preloader before the jpeg is loaded.....

could you suggest me a way to do it? or any ready made source on the web I could study? thanks!!

Flash Gallery Viewer / Video Viewer
I need to find a Flash gallery viewer that can display still images but also, when the user clicks on that image, can kick off a corresponding FLV file which plays as a video, either where the image was or in its own window on the same page. It needs to be as straightforward as possible for end-users.

Ideally it should have the form of a "pack of cards" i.e users can flip from one "card" to the next, back and forth, perhaps using two controls for left and right to browse one way or the other. The stack of images and videos behind them should also be searchable alphabetically or by other criteria (e.g name).

Does anyone have any ideas as to free Flash applications which can do this and which can be easily built / embedded into web pages?

Preloader For Loading A Jpeg?
I am loading a jpeg into a movie clip and was wonering if there is anyway of having a simple preloader for this. any suggestion?
mike

External Jpeg Preloader
I apologize if this is an easy question to answer, I tried to search for it but the search wasn't working right so I resorted to asking on here.

Is it possible to set up a preloader/bar when loading an external jpeg? I'd like to have a progress bar show up while the picture is loading.

If you can explain or provide a link it would be very much appreciated! Thanks!

JPEG/SWF Percentage Bar Preloader
Hi Folks,

Firstly, sorry for posting a question that has been well covered on these boards - I have spent a long while looking through them and I havent really found a solution that fits my needs.

I am creating a site that is mainly html, but does contain some flash content, namely the navigation at the top. I want to create a preloader that loads both the few swf files AND jpeg files, showing the combined percentage loaded along with a progress bar.

There seems to be a number of tutorials/help for creating preloaders for one external swf or jpeg, but not several, and I'm not skilled enough to edit them accordingly.

Ideally I wanted the script to work with flash 5, or at a push 6.
I'm really trying to avoid the MovieClipLoader object from MX 2004 as I want the site to work 'out of the bag' without the need for updating.

If anyone could point me to a tutorial/script/message it would be much appreciated.
I have had most success using this example: http://upproject.co.uk/dev/preloader.php but it doesnt seem to work for multiple files.

Thanks in advance.

External Jpeg Preloader Wtf?
I have been scouring the internet and all over this board to see if there is once and for all a definitive answer as to whether you can preload an external jpeg being loaded into a movie.

Does ne one know a sure fired easy way to do this?

I was told that it could be done with the preload component in MX2004 but im only on MX and my work wont upgrade me can 2004 components be used in MX. and if so where can i get them

Thanks for your help y'all rule

JPEG Preloader Yields NAN. Help
I have developed the following site:

http://www.timainsworth.com/newsite/

When an image is loaded, a preloader kicks in which works nicely except that it yields NAN before it displays a percentage readout.

Can anyone offer up any clues?

Here's the code I'm using for the preloader:


// the loader stuff
function loadJPG(theUrl)
{
holder._visible = false;
mainholder._visible = false;
loadingScrll._visible = true;
holder.loadMovie(theUrl);

var percentNum = 0;

this.onEnterFrame = function()
{
percentNum = Math.round((holder.getBytesLoaded()/holder.getBytesTotal())*100);
loadingScrll.percent = "Loading " add percentNum add " %";

if (percentNum == 100)
{
delete this.onEnterFrame;
if (holder._width<500)
{
display.gotoAndPlay("vmask");
}
else
{
display.gotoAndPlay("hmask");
}

mainholder._visible = true;
holder._visible = true;
percentNum = "";
loadingScrll._visible = false;
}
};
}

Can anyone help?

Preloader On A JPEG Image
Hello,

I was checking this forum for info on preloaders, but couldn't answer my question. Can a preloader be applied to a dynamically loaded jpeg? The image loads a couple frames after it should (late) so it pops into the sceen late. I want to hold the playhead until I know the jpeg is there. Then go next.

Most of the preloader stuff seems to look at swfs or total frames in the movie. This is just an image and the images vary in file size from 40k to 65k.

This is the code I am using now

loadMovie("pics/SLSS-09.10.04.jpg", "JPGplaceholder");

This works fine, just the images pop in to the scveen a bit late.

Any help will be appreciated.

Jpeg Preloader Tutorial
Hi all,
I hope this is an interesting question and not just a stupid (or lazy) one. I've written a bit of actionsript to do a jpeg loader (just a loadbar and no percent value displayed but that is easy to add)

My loader is crap though, for these reasons:
1. Before an image is loaded the thing shows a value of 100% and there is a delay before it jumps to something like 22% and starts loading.
2. After the image is loaded the progress bar stays on (this wasn't a problem at first because I sized all jpegs to be large enough to totally cover the bar).

There are enough of these small problems and things I've overlooked.

My problem is I'm looking for a decent tutorial or walkthrough for a jpeg loader (preloader) tutorial so that I can start with a good design rather than creating somethign that works then patching up all the problems.

Thanks in Advance
- Eric

Using A Preloader When Loading A JPEG
Hi
I've searched for hours to find info on applying preloaders when loading external JPEGS.

I can figure out how to put a preloader at the begining of my page, but
don't know how to make a preloader work for each of my pictures when a
thumbnail is pressed.
Mind helping me out with some tips?

Thanks
Ryan

http://www.ryanhamiltonphotography.com

Dynamic JPEG PRELOADER
Hi People,

I have a problem. I'm loading jpeg's dynamically into movie clips and I would like to preload them.

What code can I add to an onClipEvent(enterFrame){
to preload the jpeg which will dynamically load into the MC?

Can anyone help please?

Dynamic JPEG Preloader
I'm using Flash MX (not 2004)

I'm trying to create a preloader that I can place on thumbnails and an image display as they load their respective JPEG images. The problem is that I do not know how to get the load progress since getBytesLoaded() and getBytesTotal() do not seem to be working.

I looked into using listeners but all I can find is information about pairing listeners with the movieClipLoader class that I do not have access to.

Can someone enlighten me about how to get the load progress using Flash MX? I can easily create the rest of the preloader from there.

If its important, I have an empty movie clip called IMGHolder and use IMGHolder.loadMovie(MyIMGPath) to load the JPEG. So I've tried IMGHolder.getBytesLoaded() and it either returns 0 (initially) or the full 1901666 (end) bytes.

Further, if you think, rather if you KNOW, that .getBytesLoaded() should be working please let me know so I can try and figure out where its going wrong. Thank you.

Preloader And Dynamic Jpeg Loading
I have a movie clip into which I am loading a jpeg file based on information in a database.

Traditionally I would have done this by loading in an external .swf with a pre-loader inbuilt.

Is there anyway to detect the size of the jpeg so I can build a bar or percent loaded pre-loader??

Thanks.

Jpeg Percentage Loader (not Preloader)
The script below loads a random jpeg dynamically onto my site..

picTotal = 18;
// adjust per total pics, img1.jpg,...,imgN.jpg, where N=picTotal
name1 = "img"+Math.ceil(Math.random()*picTotal)+".jpg" ;
loadMovie(name1, _root.BG);
// use loadMovie when loading into a target movielcip
preloadI = setInterval(preloadF, 10);
function preloadF() {
if (_root.BG.getBytesLoaded()>=_root.BG.getBytesTotal ()) {
// you must reference the target level or clip.
_root.BG._x = 0;
// try 0, 0 first. see if that lines up your background pics.
_root.BG._y = 0;
clearInterval(preloadI);
}
}

how could i adapt it to show percentage of the jpeg loaded? as some jpegs take long to load and it would be nice for the viewer to see what happeneing (the jpegs are small and making them smaller would be difficult.

How To Get This Set Up? (including External Jpeg Preloader...)
Hi,
I have one day till my site launches and I'd really appreciate some feedback on this...it should be the last thing i need help on since it's not a very complicated site.

Check out this link and click on "sketchz" for example:
http://stenkat.kimasa-crew.com/sk3main.html

now, when you click on a thumbnail of one of his sketches, a low alpha grey box appears and a preloader loads the image andd voila-you see his jpeg image or whatever nicely placed in the center of the screen. click anywhere on the screen and the grey box and image disappear and you can make another selection.

I really like how that form of showing artwork is executed and would like to try it out on my site. quite a numbe of factors would come into play though which i simply do not know. I did do my research and found a thread telling you how to load an external jpeg with a preloader adn though it was helpful, i still have a couple more questions.
1)how do you get the jpeg image to load in the center of the screen like that guy did?
2)how do you get it so the image and grey box(which i know must be a movie clip) disappear upon pressing anywhere on the screen? or should i just play it simple and provide a close button. if i do that what script would i need to apply to the button so the grey box and image disappear?

so that is the bulk of it...anyone who think they can help but needs my flash file, let me know and I'll email it to you. i check here frequently.

thanks a bunch!

[F8] Load External Jpeg With Preloader
Hi

I am wanting to randomly load 1 of 10 external jpegs into an container_mc.

Does anybody know if it is possible to have a preloader for each jpeg with out making them swf's??

cheers Max

Preloader Externally Loaded Jpeg
Hi
I know how to do a preloader for swfs that are loaded externally,but
if i want a preloader for a dynamically loaded external jpeg, do i just target the prelaoder to judge the propeties of the target movie clip that the external jpeg is being loaded into?
i have tried this method and have had varied results maybe i m doing something wrong)

Thanks
Michael

Help Needed For A Jpeg Preloader... Agonizing.
I am loading jpegs into a movie clip loader and need a preloader right before. I am using a simple transparency fader on frames 2-15, so would like to have the image completely loaded into the movie clip 'loader' before I start the fade.
Check out the link below. You can see that the images 'pop' in. They are displayed after the fader has passed by. This is really obvious when you are visiting for the first time and they haven't been loaded into the computer cache, after they are loaded you can see the fader working quite nicely, as if they were 'unveiled' after being loaded in.
Any advice would be really, really appreciated.

http://inadequateanimal.com/index2.html


The code I am using points to the 'topleftloader' movie clip from frame 1 of the 'topleft' movie clip. The fader begins on frame 2.


filename = ["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg", "07.jpg", "08.jpg", "09.jpg"];
path = "pictures/topleft/";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], topleftloader);

Thanks!

Creating A Preloader For Loading A JPEG
Hey, I need to create a preloader (basic one) for loading a JPEG file so that once the file is loaded I can manipulate it's properties..

At the moment I have the Images loading into MC which is contained in another movie clip MCholder say.

How do I go about creating a preloader since the gettotalbytes is only available after it's loaded it always returns 0

?

Thanks

How To Make A Preloader For An External Jpeg?
hi friends..
im pretty new to flash and photoshop.. n its ma first post . i been struggling long enough to make a proper site.. been goin to some tutorials and bla bla bla

i got lots of questions to be asked .. but me start with this one .. its abt ma gallery which i found and played around n came out with this

Gallery

its small so please adjust.. n it might take few secs to load an image n one more thing.. only few images load cuz i havent uploaded much images n only the name ones load not the ones like Image 11 , 12 n yada yada


well the same question was asked before i guess 2 days back abt preloader for external jpegs.. its the same concept i guess n after readin it i couldnt understand how it works..

preloader for external jpg


i just want to teach , show me how to make a preloader for jpegs ?
it would be great help for me please?

Thanking you
Muneeb

Preloader For External Jpeg Loading?
I can find plenty of tutorials on setting up preloaders for main movies and such, but I have a series of JPEGS that will be loaded into a clip ("holder"), and need the images to have a preloader attached.

I know that onClipEvent() will be used, but am not sure how. Does anyone know of a tutorial or thread dealing with this? Or know how to go about it?

I've done a search of this and the FlashKit forums and find preloading jpeg threads, but not dealing with this exactly.

Thanks

Dynamic .jpeg Preloader Problem
Last edited by Webcat : 2003-07-18 at 15:10.
























Greetings.

I am having a problem with a preloader for a dynamically loaded menu of product thumbnails.

I need to find a way to ensure that all of the product images have been loaded before the menu is revealed. It does this by counting loaded thumbnails untill it matches the total number of products to be loaded in the menu, triggering the fadein action.

I have been using getBytesTotal and getBytesLoaded to measure the loaded movie however my script does not seem to be measuring the actual size of the .jpg's that I am loading into the dynamic movie clip.

I have posted my code below.

Any help would be appreciated.


product = _root.catnav.nav.attachMovie("product_thumb", "product_thumb"+i, i);

loadMovie("images/Thumbnails100/"+product+"_t.jpg", "product.image");

product.onEnterFrame = function() {

if (_root.catnav.loaded=="false") {

if (product.image.getBytesLoaded()>=product.image.getBytesTotal() ) {

_root.thumbnails+=1;

}

}

};

Reusing Preloader For An External Jpeg FlashMX Pro
Hello all,
I have a preloader which works great for the main swf
Now I want to use the same preloader for an external jpeg file
when i create the blank mc how do I code the preloader for multiple external jpeg files? (Slide presentation)

Many thanxs in advance

Paul

Preloading Jpeg Files (preloader Sequence Error With IE)
// preloader
j = 1;
_root.createEmptyMovieClip('preloader', 12);
preloader._x = Stage.width/2;
preloader._y = Stage.height/2;
preloader._alpha = 0;
_root.createTextField('preloaderText', 13, (Stage.width/2)-25, (Stage.height/2)-25, 300, 100);
Int = setInterval(function () {
if (j<9) {
preloader.loadMovie('image'+j+'.jpg');
bytesLoaded = preloader.getBytesLoaded();
bytesTotal = preloader.getBytesTotal();
trace(bytesLoaded);
if (bytesTotal>0) {
if (bytesLoaded == bytesTotal) {
j++;
trace("image"+j+" loaded");
} else {
preloaderText.text = 'loading...'+bytesLoaded;
preloaderText.autoSize = "left";
trace(bytesLoaded+" of image"+j);
}
}
} else {
removeMovieClip("preloader");
removeMovieClip("preloaderText");
play();
clearInterval(Int);
}
}, 1000);


My problem is while it works fine with NETSCAPE > 6 browser it doesnt with IE 6

Now I use flash player 6 plugin on both browsers
I am using a DIAL UP
it works with IE with other people because they are using a faster connection
in IE i notice that the status bar shows a 'downloading' status when loading the flash movie yet it doesnt seem to continue after that.

the movie can be viewed at
http://www.onlinetnt.com/draft/flash/DIALUP_REDRAFT.swf

What is wrong here

Preloading Jpeg Files (preloader Sequence Error With IE)
// preloader
j = 1;
_root.createEmptyMovieClip('preloader', 12);
preloader._x = Stage.width/2;
preloader._y = Stage.height/2;
preloader._alpha = 0;
_root.createTextField('preloaderText', 13, (Stage.width/2)-25, (Stage.height/2)-25, 300, 100);
Int = setInterval(function () {
if (j<9) {
preloader.loadMovie('image'+j+'.jpg');
bytesLoaded = preloader.getBytesLoaded();
bytesTotal = preloader.getBytesTotal();
trace(bytesLoaded);
if (bytesTotal>0) {
if (bytesLoaded == bytesTotal) {
j++;
trace("image"+j+" loaded");
} else {
preloaderText.text = 'loading...'+bytesLoaded;
preloaderText.autoSize = "left";
trace(bytesLoaded+" of image"+j);
}
}
} else {
removeMovieClip("preloader");
removeMovieClip("preloaderText");
play();
clearInterval(Int);
}
}, 1000);


My problem is while it works fine with NETSCAPE > 6 browser it doesnt with IE 6

Now I use flash player 6 plugin on both browsers
I am using a DIAL UP
it works with IE with other people because they are using a faster connection
in IE i notice that the status bar shows a 'downloading' status when loading the flash movie yet it doesnt seem to continue after that.

the movie can be viewed at
http://www.onlinetnt.com/draft/flash/DIALUP_REDRAFT.swf

What is wrong here

Almost There A Bit Of Someones Time Please? Jpeg Loading Into MClips +preloader
hi all,

urm i picked up this code just now as i did a search and with a little tailoring this will suit my needs perfectly,

- On the main stage ive got an empty MClip called "link"

- ive also got a light colored grey box curently the height and width of the stage called "loader"

the script below would seem perfect for what i want, as by changing the jpeg referance for each button instance name, i could have my pics displayed inside the link movieclip with a preloader each time!

heres the code on main timeline:



Code:
loader._visible = false;
finishedLoad = 0;

_root.onEnterFrame = function() {
if (finishedLoad!==1){
loader._visible = true;
lBytes = picLoad.getBytesLoaded();
tBytes = picLoad.getBytesTotal();
percentLoaded = Math.floor((lBytes/tBytes)*100);
loader._xscale = percentLoaded;
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
loader._visible = false;
finishedLoad = 1;
} else {
finishedLoad = 0;
count++;
}
}
}
}

leaf2.onPress = function() {
picLoad = loadMovie("IMG01.jpg", "_root.link");
finishedLoad = 0;
}
3 PROBLEMS::::

1) you can see the grey loader in background, its still visible, why?

2)preloader doesnt work

3)when the button is clicked and pic loads in its not fitted right, even though its the exact same size as the contianer MClip thats holding it, it looks too big almost enlarged and doesnt fit well + off centre

but... it does load the picture in the background movie clip,

where am i going wrong guys??????

please, please please can someone lend a hand?

9114

Preloader Not Displaying Progress On Externally Loaded Jpeg
Hi,

I am in the process of making an interactive tour plan, which quite simply is a floor plan of a building which when interacted with by the user shows a description and image of the room in question. With the image I am loading the jpeg externally (using a tutorial I found on the web) and it works fine except the preloader, which is a component does not work, it sticks on 0% and then the image pings in. I'm not really sure why this is happening - can anyone help?

The fla file can be found here: http://www.chaosdesign.com/englemere...ourWedding.fla

Many thanks
Bev

Preloader Destroys Jpeg Quality Despite Increase Compression Setting
-I have added a regular preloading scene to my movie which decreases the resolution of the scene it is loading for...before I add the scene..everything is fine...after the scene is added....the resolution drops way down......

I Have changed the export settings for the jpeg but nothing seems to work...anyone have any ideas?

thanks Hasan

JPEG Loading... How Do I Wait Until The Jpeg Has Loaded
Hi everyone!

this is the code that I currently use. I want to be able to wiat until the jpeg is loaded before going trought the loop again.....
any ideas? I have tried to use the getBytesLoaded and getBytesTotal but they always show up as 0. Very annoying.


Code:
var currentX = 0
for (k=0;k<galleryVar.items;k++){
_root.thumbslider.createEmptyMovieClip("thumb" + k,(50 + k));
eval("_root.thumbslider.thumb" + k)._x=currentX;
loadMovie(_root.categoryList+"/thumbnails/"+_root.imageArray[k]+".jpg",eval("_root.thumbslider.thumb" + k));
currentX = currentX + eval("_root.thumbslider.thumb" + k)._width;
trace("Pic" + k + " " + currentX);
}
the "currentX" (2nd line from the bottom) doesn't get a value because the jpeg doesn't get loaded quickly enough. How can I wait for the jpeg to load before going through the loop again.
I don't want to use frames becasue I am creating everything dynamically!
Am i making sense?

Hope someone can help me!

Thanks
A

Loading External Jpeg Via External Preloader
mx2004

hello all, i have a button which loads an external jpeg from a folder. what i want is to have it so when the command to load the external jpeg is sent, an external preloader preloads it in the placeholder. this preloader will be generic so it can be applied to load before any image selected in any folder, for updating purposes. anyone know where to start with action script, or how to set it up,

Pic Viewer Help
I need help with a pic viewer I'm trying to make. The slider is suppose to follow the curser with in the "film" graphic and display a larger view in the window. I found a .fla on flashkit that showed me how but something still isn't working just right. Please take a look at my .fla.

http://www.geocities.com/rushonline2...hPicViewer.fla

Any help would be appreciated! Thanks for your time.

Viewer 360
hi. There is a 360 Viewer where you can see a picture to the left and to the right. If anybody have seen this. How can I change this picture for one of my own. I dont know if I have to create a new movie clip or whatever. Somebody knows a tutorial for learning to do this.
Thanks.

360 Viewer
i have 360 viewer that is a .mov and i'm trying to import it into flash and it looks like it won't happen.

does anyone have any suggestions as to import something like that into flash somehow?

Map Viewer
plz help me ...im trying to design map viewer can zoom and drag and click .....plz help im not good in Action Scripting......

RSS Viewer
I have downloaded the RSS Viewer example from www.adobe.com/go/learn_programmingAS3samples_flash (The RSSViewer application files can be found in the folder Samples/RSSViewer) It works very well when the file is on my computer.
But once i uploaded it to a hosting server, it is not working!

Kindly, can somebody help me?

You can see the application with that issue on www.metfar.ca/RSS.

Thanks For your Helps!

Elias

RSS Viewer
I have downloaded the RSS Viewer example from www.adobe.com/go/learn_programmingAS3samples_flash (The RSSViewer application files can be found in the folder Samples/RSSViewer) It works very well when the file is on my computer.
But once i uploaded it to a hosting server, it is not working!

Kindly, can somebody help me?

You can see the application with that issue on www.metfar.ca/RSS.

Thanks For your Helps!

Elias

Pi Viewer
I saw a link about some crop circle , and inspired me to do this in flash, a simple PI viewer.
This sample is showing 29 decimals, but it can be easily configured for more.
The engine used is Five3D + a Wedge class made by pixelwelders specially for this 3D engine
you can get the sources here

360 Viewer
has anyone worked on an application to create a 360 view of any given object? there are several applications where you can look inside a car/real estate. i was wondering if this can be done with cF.
one example can be seen at
http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=5672



.swf Viewer Or Explorer
Does anyone know of a good swf viewer or explorer?

Picture Viewer
how to create a picture viewer where when
u click on the "next button" the next picture
will show up ?
i couldn't find such tutorial in the tutorials
section.

Copyright © 2005-08 www.BigResource.com, All rights reserved