Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with a preloader in AS3

Explorer ,
Aug 17, 2013 Aug 17, 2013

Hi,

I upload a website and I have problems with the preloader did it in AS3. It starts after two or three minutes. I have a MC with an animation of 100 frames and the dynamic text of the percent. The preloader is located in the 1 frame to the 10, I mean, first frame with the actions and the other three layers (text, MC and background) with a lenght of 10. The movie has 525 frames. Here is the code:

stop();

addEventListener(Event.ENTER_FRAME, lodeando);

function lodeando(event:Event):void

{

          var bytesTotales = stage.loaderInfo.bytesTotal;

          var bytesCargados = stage.loaderInfo.bytesLoaded;

          var porcentaje = Math.round(bytesCargados * 100 / bytesTotales);

          textoPorcentaje.text = porcentaje + "% Cargados";

          cargaAnimada_mc.gotoAndStop(porcentaje);

          if (bytesCargados == bytesTotales)

          {

                    removeEventListener(Event.ENTER_FRAME, lodeando);

                    gotoAndPlay(2);

                    textoPorcentaje.text = "";

                    removeChild(textoPorcentaje);

                    removeChild(cargaAnimada_mc);

          }

}

Please, Could you help me?.

TOPICS
ActionScript
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2013 Aug 17, 2013

your preloader will start to display AFTER all embedded fonts are loaded and AFTER all items exported for use with actionscript are loaded unless you take specific steps to prevent those objects from loading in frame 1.  ie, you must mark classes to export in a frame other than 1 (file>publish settings>swf>advanced as settings) and you must untick those library items you do not want to export in frame 1.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 17, 2013 Aug 17, 2013

Thanks kglad, Please, Could you explain it more detailed?, I do not understand at all. Sorry. I go to file>publish settings> but there are not a swf>advanced as settings. In the settings are only the formats and flash tabs. I use a CS4 version. I change the frame 1 in export document class to 10 and the preloader takes a lot of time and it produces the following errors:

ReferenceError: Error #1065: No se ha definido la variable sprite3_4.

ReferenceError: Error #1065: No se ha definido la variable sprite2_5.

ReferenceError: Error #1065: No se ha definido la variable sprite3_4.

ReferenceError: Error #1065: No se ha definido la variable sprite2_5.

How can I untick those library items that I do not want to export in frame 1?.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2013 Aug 17, 2013

you have to fix those errors, first.

click file>publish settings>swf and tick "permit debugging".  retest.

the problematic line numbers that contain those undefined variables will be in the new error messages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

I did the export frame class to 10, ticked permit debugging and again the preloader is ok but still delays a lot from the main animation. How must I do to solve that?, Is it a problem of code?. Remember that it preload an animation of 525 frames.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2013 Aug 18, 2013

if you did that correctly, the only delay (before the preloader appears) is the time it takes to download the assets used by the preloader.  again, there are two panels where you must change the export frame: the advanced actionscript settings panel and (in possibly multiple places) in the library panel.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

Kglad thanks, Where I must change the settings?, I did not find them. How I can change the library panel?. Can you attach a screen capture of those?. Is an error of the code?.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

If I clicked the info in the library panel selecting the objects and ticked the export for action script and export to frame 2 there is an error that says that:

There are the following JavaScript errors

, however there are not appearing the fails.

Here are the screen captures:

ActionScript configuration:

Action Script 3.0 configuration.jpg

Library information selecting objects except the preloader ones:

Library information.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

And Publish settings:

Publish settings.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2013 Aug 18, 2013

you're not exporting your needed library items.  tick that exportar para actionscript box and tick to export in frame 10 for all items that need to be exported for use by actionscript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

When I did it (tick that exportar para actionscript box and tick to export in frame 10), I understood excluding the preloader objects, suddenly an error appears saying:

Have produced the following JavaScript errors

, and those not appear to know them.

Other thing the movie, after the preloader,  starts in frame 10.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

This is the JavaScript error window:

JavaScript errors.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

There is a thing that I do not have cleared, What I must export to ActionScript and frame 10?. The whole library or only the preloader items?. I can do it manually by clicking in Properties of each component of the library.

There are items that I do not edit the properties too export them such as the graphics. Is that correct?.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2013 Aug 18, 2013

your preloader should not use anything exported for actionscript (including fonts).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

Did you mean that I must export ActionScript and frame10 all the objects except the preloader folder?.

I did it and I totally destroy the website. I think that not all objects must be exported. Is that correct?.

Let me resume:

- Preloader in frames 1 to 10. Has a gotoAndPlay in frame (2)

- Animation in frames 10 to 525.

Publishing settings:

- Allow debugging ticked.

ActionScript settings:

Export class to frame 10 ticked, Is that correct?. If the preloader has a gotoANdPlay in frame 2 Why I must put this on 10?.

Is possible to send you the .fla to correct the preloader error via We Share service?.

Thanks again, and excuse me.

Should I export the same class as it is described in the various ActionScripts codes that I have in the website?.

I mean if it matchs as btn_oza I must put in the class the same.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2013 Aug 18, 2013

Please kglad, help me.

I must to export all the objects that appear in the different ActionScript codes?, Including the pictures?.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2013 Aug 18, 2013

anything you want to use in your preloader has to be exported in frame 1 where your preloader exists.  anything not needed by the preloader should be exported in a later frame so it does not download and delay the appearance of your preloader.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 19, 2013 Aug 19, 2013

These screen captures show the library of the movie. As you can see I export the most of them. However I have doubts about if I must convert to symbol the graphics. I have the preloader in the "presentación" folder without any exportation.

Imagen 1.pngImagen 2.png

Imagen 3.png

Imagen 4.png

Imagen 5.png

Please, Could you correct the website?. Please, tell me an e-mail address and I send you the website via WeTransfer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

you can send me an email via:  http://www.kglad.com > contact.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 19, 2013 Aug 19, 2013

Thanks for the reply. I mean a valid e-mail address from you to send the .fla file via WeTransfer service. Is right the screen captures?.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013
LATEST

send me an email via my website and i'll reply so you have my email address without me exposing it or encrypting it here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines