Skip navigation
Currently Being Moderated

Using Preloader But Content Not Loading

Jul 16, 2012 12:01 PM

Tags: #text #html #dynamic #actionscript #preloader #as3.0 #movie #actionscript3 #clip #html_and_css

Hi.

 

Here's the Cliffs Notes version:

I've a 2 frame movie: Frame 1 is the preloader; Frame 2 a movie clip (web site).

 

Both work fine individualy, but the dynamic content I want pre-loaded is not loaded into the movie clip (web site) after the preloader animations.

 

 

Verbose version:

 


I'm have a preloader on frame 1 of the timeline. Here's the code:

 

stop ();


this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, onLoading);
this.loaderInfo.addEventListener (Event.COMPLETE, onComplete);


function onLoading (evt:ProgressEvent):void
{
          var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
          percent_txt.text = (loaded * 100).toFixed(0) + "%";
          var counter = (loaded * 100) * 3.6;
          masked_mc.mask = masking_mc;
          masked_mc.rotation = counter;
//          trace (masked_mc.rotation);
          if (masked_mc.rotation < 0)
          {
                    masked_mc.mask = null;
          }
}


function onComplete (event:Event):void
{
          this.loaderInfo.removeEventListener (ProgressEvent.PROGRESS, onLoading);
          this.loaderInfo.removeEventListener (Event.COMPLETE, onComplete);
          gotoAndStop (2);
}

 

On frame 2 is only a movie clip (a web site).

 

In this movie clip on frame 1, I have a dynamic text field into which gets loaded some external text, styled with HTML and CSS.

 

At the moment, when a visitor comes to the site for the first time, he can actually see the text load, then see the CSS styles get applied. I would like to use my preloader so that this text loading and styling is completed before they get to see the home page.

 

Trouble is the, while the preloader itself works, the HTML and CSS still does not get loaded until after the preloader. This makes sense as the code for calling and loading the HTML/CSS is in the movie clip.

 

So I thought, put the code....

 

//NEWS --------------------------
// Load the external .swf "navidNews.swf".
var navidNewsSWF:String = "assets/fla/navidNews.swf";
var navidNewsURLRequest:URLRequest = new URLRequest(navidNewsSWF);
var navidNewsLoader:Loader = new Loader();
navidNewsLoader.load(navidNewsURLRequest);

//Put "navidNews.swf" on the stage.;
newsContainer_mc.addChild(navidNewsLoader);


 

into frame 1, same as that for the code for the preloader. But because the empty movie clip into which navidNews.swf is loaded is not in the same frame as the preloader there are errors.

 

Okay, move empty movie clip newsContainer_mc into frame 1 with preloader, which will hide the news container.

 

What am I missing? Should I not put a movie clip of my web site on frame 2, but instead move the preloader into the web site movie clip, putting it on frame 1?

 

I've been playing musical frames with this thing for two days now.......

 
Replies
  • kglad
    62,158 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 16, 2012 12:41 PM   in reply to Slateclean

    load the text and css in frame one (they need not be be used until frame 2) and incorporate those into your preloader.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points