A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Preloader in document class

  1. #1
    Member
    Join Date
    Nov 2007
    Location
    New Zealand
    Posts
    31

    Preloader in document class

    Hi Everyone,

    I am making a website where one main swf loads several other swf components into it, and the first step is for the loadbar swf to be loaded in. This is the bit I am having trouble with so far:
    Code:
    package
    {
        import flash.display.MovieClip;
        import flash.events.*;
        import flash.display.Loader;
        import flash.net.URLRequest;
        public class MainClass extends MovieClip
        {
            public var loadBar = new Loader();
            
            public function MainClass()
            {
                loadbar.contentLoaderInfo.addEventListener(Event.COMPLETE, addLoadBar);
                loadBar.load(new URLRequest("interface/loadbar.swf"));
            }
            
            function addLoadBar(e:Event):void
            {
                loadBar_mc.addChild(loadBar);
    
            }
        }
    }

    I am getting the following errors:

    Location:
    MainClass.as, Line 3
    Description:
    1046: Type was not found or was not a compile-time constant: loadBar.
    Source:
    import flash.display.MovieClip;


    Location:
    MainClass.as, Line 13
    Description:
    1120: Access of undefined property loadbar.
    Source:
    loadbar.contentLoaderInfo.addEventListener(Event.C OMPLETE, addLoadBar);



    Hopefully you can get what I'm trying to do; loadBar_mc is an empty movie clip on the main.fla stage which I am using just to position the loadbar.

    I realise the solution is probably very simple but I'm pretty new to this!

    Thanks!

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    In MainClass you have "loadbar" where you want "loadBar" - and I'm guessing that the other error is a broken library linkage (probably your loadBar_mc is trying to connect to the LoadBar class???)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center