Today is the day the preloading will work! Help...

I've tried and tried to find different ways to make the preloading work correctly but there is always something that doesn't seem to work with each way. Could someone dumb it down for me and help me understand how to make this work. I've read everything on the safeloader and at this link:
http://www.stevensacks.net/2010/05/28/flash-cs5-tlf-engine-causes-errors-with-loaded-swfs/
I've also browsed all blogs and adobe tech notes and just had no luck getting a way that always worked. Here is what I'd like to do:
Create a preloader swf that contained a movie clip to display the percent.
Allow the preloader swf to call functions inside of the loaded swf. (this is for stage resizing, usually)
Be able to use the tlf textengine in my loaded swf's.
Keep my reference to the stage or pass it from the preloader swf to the loaded swf.
Every way I've tried seems to lose at least one of these items. Right now I have a file that uses the tlf textfield and a stage reference. It works fine as a standalone swf but it needs a preloader. In the as 3 settings the tlf is merged into the code. The extra size isn't that big of a deal, for now. However, I would love to not do that and point the preloader away from adobe's stock preloader to my own in the as 3 settings. However, I can never get it to work correctly.
Can anyone point me in the right direction? Thanks!

Kglad, I created a system
that works. I will post it here so others can use it if needed.
Outline: I'm using a custom preloader.swf to load another swf file. The loaded swf file contains a document class and the tlf textfield. I am able to load this correctly, track the percent loaded, pass the stage reference, use the tlf textfield and use the stage resize functions to dispatch listeners for sites that are 100% of the browser.
THE PRELOADER SWF
This file simply contains the preloader movieclip in the library and code in frame 1. I guess a doc class would work here but I have not tested. The AS 3.0 settting are the default settings for player 10.
Code:
//======================================================================================== =================================================
//     import classes
//======================================================================================== =================================================
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.filters.BevelFilter;
import flash.display.MovieClip;
import flash.display.Loader;
//======================================================================================== =================================================
//     set stage alignment
//======================================================================================== =================================================
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.ACTIVATE, activateHandler);
stage.addEventListener(Event.RESIZE, resizeHandler);
//======================================================================================== =================================================
//   variables
//======================================================================================== =================================================
var pre_loader:Preloader;
var this_page:String = "sbBackground.swf";
var load_bar_width:Number = 150; // make this the width of your image
//======================================================================================== =================================================
//    variables
//======================================================================================== =================================================
function activateHandler(event:Event):void {
trace("here");
//======================================================================================== =================================================
//    variables
//======================================================================================== =================================================
function resizeHandler(event:Event):void {
trace("resizeHandler: " + event);
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
//======================================================================================== =================================================
//    variables
//======================================================================================== =================================================
var background_ldr:Loader;
var background_mc:MovieClip;
var background_holder:MovieClip = new MovieClip();
addChild(background_holder);
//======================================================================================== =================================================
//    init site
//======================================================================================== =================================================
function init():void{
// show preloader
pre_loader = new Preloader();
addChild(pre_loader);
pre_loader.x = Math.round(stage.stageWidth/2) - Math.round(pre_loader.width/2);
pre_loader.y = Math.round(stage.stageHeight/2) - Math.round(pre_loader.height/2);
pre_loader.load_bar.width = 1;
// load page
loadThisPage(this_page);
//======================================================================================== =================================================
//    load called page
//======================================================================================== =================================================
function loadThisPage(thisPage:String):void{
// load new page
background_ldr = new Loader();
var pageRequest:URLRequest = new URLRequest(thisPage);
background_ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, pageCompleteHandler);
background_ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, pageProgressHandler);
background_ldr.load(pageRequest);
function pageCompleteHandler(loadEvent:Event){
background_mc = MovieClip(background_ldr.content);
background_holder.addChild(background_mc);
removeChild(pre_loader);
function pageProgressHandler(e:ProgressEvent){
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded / total;
trace(pct);
pre_loader.pct_txt.text = String(Math.round(pct * 100)) + "%";
pre_loader.load_bar.width = Math.round(pct * load_bar_width);
THE LOADED SWF
This file also used the default settings for Flash player 10. Therefore, I am not merging into the code my tlf library so no increase in file size.
The doc class:
package com {
// core
import flash.display.MovieClip;
import flash.display.Stage;
import fl.text.TLFTextField;
import flash.events.Event;
// import custom classes
import com.main.BuildStageClass;
// initialize class
public class DocClass extends MovieClip {
  // custom classes
  // variables
  public static var build_stage_class:BuildStageClass;
  // stage containers
  public static var main_stage:MovieClip;
  // private toggle var
  private var init:Boolean = false;
  // main constructor
  public function DocClass() {
   addEventListener(Event.ADDED_TO_STAGE, stageAddedHandler);
  private function stageAddedHandler(e:Event){
           // trace("Document Class Stage: " + this.stage);
   // initialize classes
   build_stage_class = new BuildStageClass();
   // wait until second added to stage call to initialize application
   if(init == false){
    init = true;
   else{
    removeEventListener(Event.ADDED_TO_STAGE, stageAddedHandler);
    // add containers to stage
    main_stage = new MovieClip();
    addChild(main_stage);
    // start app
    startApplication();
  public function startApplication():void{
   //trace("here at start");
   // build stage
   build_stage_class.buildStage();
This works 100% for me without using the safeloader in the preloader.swf. I've experienced some issues with the safeloader before so not using it is a blessing.
I hope this helps someone! Enjoy.

Similar Messages

Maybe you are looking for

  • HT4993 iPhone 4s IOS 6.1.1 Calendar issue

    I upgraded my iPhone 4s to iOS 6.1.1 two days, after the upgrade, my calendar is not working correctly. Any event which is not created by me could not be edited, As soon as I open the event, I get either to "decline", "MAyBe" or "Accept" option. Even

  • Passing Object parameters to Procedures in Oracle

    Hi, Can any one please provide me with a sample example how to pass object types as parameters (IN) to a procedure/package. Thanks in Advance.

  • Nested Tables Repeat Header Row RTF Output Not Working v5.6.2(PDF does)

    All, Has anyone used nested tables in heading rows where they are set to repeat nested table header row across page breaks for RTF output ? This seems to work for PDF generation (line breaking enforcement doesn't) but I don't even get RTF Header ROWS

  • Screen sharing redraw problem

    I am seeing graphical redraw problems when I try screen sharing with another Mac 10.8 computer, Mac Mini mid 2011. For example, when switching menus, the old ones remain. This always worked just fine in Lion. I tried turning adaptive and scaling off

  • Which setting takes priority??

    I have an user base of 500 users.I do not want to schedule the reports. All the users will open the reports and view the data. Since there are 500 users they do not want the users to hit the database 500 times. They want to make use of the Cache TIme