Jump to content
Sign in to follow this  
divinedesigns1

ifFrameLoaded

Recommended Posts

hey i keep getting this error, when i try to make a simple pre-loader /* this is from a tutorial, since i did not know how to make one */ anyway when i try to use the ifFrameLoaded function it gived me this error

Scene 1, Layer 'action', Frame 1, Line 1 1180: Call to a possibly undefined method ifFrameLoaded.
this is after i insert the semicolon from the first error
Scene 1, Layer 'action', Frame 1, Line 1 1086: Syntax error: expecting semicolon before leftbrace.
and this is the original code for the pre-loader to work
ifFrameLoaded("s1"){ x = 1; play();}

and this is the edited code, where the error asked to insert a semicolon before the leftbrace on line 1, frame1

ifFrameLoaded("s1");{ x = 1; play();}

:huh: am i the only one used this section?

Share this post


Link to post
Share on other sites

I don't think I'ver heard of an "ifFrameLoaded()" method. Are you sure you didn't miss something from their tutorial? This isn't proper syntax:

ifFrameLoaded() {}

It should be one of these two:

ifFrameLoaded(); if(FrameLoaded) {}

Here's part the code for my most recent preloader in ActionScript 2

// playButton is a reference to a buttonplayButton._visible = false;stop(); // loader is a reference to a movieclip that has nothing but a blue rectangle in it.var width = 0; // A variable to store how wide the loading bar should bevar all = getBytesTotal();// On each frame update the loading baronEnterFrame = function () {    // Make the width a ratio of the loaded bytes compared to the total bytes of the file    width = getBytesLoaded()/all;    // Update the size of the loading bar    loader._xscale = width*100;     // If everything is loaded, display the play button    if (width == 1) {   	 playButton._visible = true;    }}; // When the playbutton is clicked start the movieplayButton.onRelease = function() {    gotoAndPlay("start"); // "start" is the name of the first frame of the animation};

Share this post


Link to post
Share on other sites

yeah i think thats what it should of been, but the person put ifFrameLoaded http://www.entheosweb.com/Flash/preloader2.asp thats the link to it, and thanks for the code, ill placed it in my file of codes

Share this post


Link to post
Share on other sites
yeah i think thats what it should of been, but the person put ifFrameLoaded http://www.entheoswe.../preloader2.asp thats the link to it, and thanks for the code, ill placed it in my file of codes
What a waste of frames. 40 frames for a preloader? I'm not even sure what they're doing with that code.My preloader is on one single frame and, with a bit of imagination, you can manipulate a lot of properties of the loading bar. You could make it change color, rotate, you could use masks to show part of a picture.

Share this post


Link to post
Share on other sites
What a waste of frames. 40 frames for a preloader? I'm not even sure what they're doing with that code.My preloader is on one single frame and, with a bit of imagination, you can manipulate a lot of properties of the loading bar. You could make it change color, rotate, you could use masks to show part of a picture.
so i guess i should start over huh?

Share this post


Link to post
Share on other sites

so i downloaded the person flash file to see if ill get the same errors :Shock: not one single error

Share this post


Link to post
Share on other sites

Hmm, I suppose there's some weird "ifFrameLoaded(){}" structure in ActionScript. I don't really like the way they made that, though. I'm quite sure that's not how it's done professionally.

Share this post


Link to post
Share on other sites

well you have time to put together a quick tutorial for me?

Share this post


Link to post
Share on other sites

Here's a good tutorial: http://www.kirupa.com/developer/mx/percentagepreloader.htm There are only two things you really need to know: getBytesLoaded() and getBytesTotal()getBytesTotal() returns the size of the flash file, getBytesLoaded() returns the amount of the file that has loaded already. When getBytesTotal() is equal to getBytesLoaded() then the document has loaded and you can jump to another frame or display a play button or whatever you want. If you want to show how much percent is loaded divide getBytesLoaded() by getBytesTotal() and multiply by 100. If you want to show mow many bytes have loaded, just print out getBytesLoaded(). You can use movieclips, textfield objects and buttons on the first frame of your document to display these values. Don't forget, the first thing you need to do is call the stop() method so that the document will stay on the current frame until everything is loaded, you can use gotoAndStop() or gotoAndPlay() to move to another part of the movie once everything is loaded or when a button is clicked.

Share this post


Link to post
Share on other sites
Here's a good tutorial: http://www.kirupa.co...gepreloader.htm There are only two things you really need to know: getBytesLoaded() and getBytesTotal()getBytesTotal() returns the size of the flash file, getBytesLoaded() returns the amount of the file that has loaded already. When getBytesTotal() is equal to getBytesLoaded() then the document has loaded and you can jump to another frame or display a play button or whatever you want. If you want to show how much percent is loaded divide getBytesLoaded() by getBytesTotal() and multiply by 100. If you want to show mow many bytes have loaded, just print out getBytesLoaded(). You can use movieclips, textfield objects and buttons on the first frame of your document to display these values. Don't forget, the first thing you need to do is call the stop() method so that the document will stay on the current frame until everything is loaded, you can use gotoAndStop() or gotoAndPlay() to move to another part of the movie once everything is loaded or when a button is clicked.
ok thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×