Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 4 of 4
  1. #1

    Default How to I hide /remove preloader bar when done?

    Ok why wont this work?

    Trying to do a

    Navigation bar button , to preloader to abour me page with a photo component.

    Not on the pre loader page the bar works, only it wont disappear.


    [pre]siteLoader.loadMovie("AboutMe5.swf",4);


    Frame_movie._alpha = 100;
    loadingBar._alpha = 100;


    loadingBar._xscale = 1;

    loadingBar.onEnterFrame = function()
    {
    kBytesLoaded = this._parent.siteLoader.getBytesLoaded() / 1024;
    kBytesTotal = this._parent.siteLoader.getBytesTotal() / 1024;
    percentage = Math.round(kBytesLoaded / kBytesTotal * 100);
    this._xscale = percentage;

    if ("percentage" ==99) {


    loadingBar._alpha=0;
    Frame_movie._alpha=0;

    delete this.onEnterFrame;
    }

    }[/pre]

    The nav bar has the following script

    [pre] Button_AboutMe.onRelease = function(){
    unloadMovie(4);
    loadMovie("AboutMe_Loader.swf",4);
    }
    [/pre]


    The loaded film used to just have as the script

    stop();

    now I added this script to the final AboutMe5.swf file to try and hide the bar but does not work, also tried using different layers and the unloadMovie(4); script. It did not work.



    [pre] unloadMovie(4);
    loadingBar._alpha=25;
    Frame_movie._alpha=25;

    SiteLoader._alpha = 10
    // loadingBar._alpha=1;
    // this._alpha=1;
    //Frame_movie._alpha=1;
    [/pre]

    Now Frame_move is a mov (and tried button) and the laoding bar is a mov file. I can make these fade by adusting the alpah but this only works accross the film. I cannot trigger it with the line.



    [pre]if ("percentage" ==99) {[/pre]

    Ive tried with and without single and double quotes. and plane.

    tried replacing percentage with

    this._xscale
    loading bar


    Nothing works.

    it appears to be the if script thats the problem not triggering the fad or gettig red of the pre loader altogether.




    the website is www.chriscreativity.com


    Also tried

    if (percentage = 99) {
    if (percentage == 99) {
    if ('percentage' == 99) {
    if ("percentage"== 99) {
    if (this._xscale = 99) {
    Attached Files

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Hello. First off, do not use [pre]. Instead, use the [code] button when you want to display code.
    Second, why would you be checking for 99%? That doesn't make any logical sense. Check for either 100 or >= 99. I say this because the loadMovie function doesn't necessarily update for every 1% it loads. It could very well be skipping from 0% straight to 100%, in which case, 99% or any in between will never occur.
    Third, if you are trying code such as:
    Code:
    if (percentage == 99) {
    if ('percentage' == 99) {
    if ("percentage"== 99) {
    Then you probably need to read a book about programming or do some research. When dealing with variables, you never put quotes around the name. When dealing with comparison, you always use == sign. The single equal (=) sign means "assign to;" where as, the double equal (==) sign means "is equal to?" So in an if statement, if you are trying to compare two things, always use the double equal sign.
    Last edited by Vlykarye; 12-22-2011 at 08:36 PM.

  4. #3

    Default Working script

    Code:
    stop();
    siteLoader.loadMovie("Aboutme5.swf",4);
    Frame_movie._alpha = 100;
    loadingBar._alpha = 100;
    loadingBar._xscale = 1;
     
    loadingBar.onEnterFrame = function() {
     
        kBytesLoaded = this._parent.siteLoader.getBytesLoaded()/1024;
        kBytesTotal = this._parent.siteLoader.getBytesTotal()/1024;
       
        if (kBytesLoaded>1) {
     
            percentage = Math.round(kBytesLoaded/kBytesTotal*100);
            this._xscale = percentage;
     
            if (percentage>=99) {
     
                Frame_movie.swapDepths(this._parent.getNextHighestDepth());
                Frame_movie.removeMovieClip();
                this._parent.nextFrame();
                delete this.onEnterFrame;
                loadingBar.swapDepths(this._parent.getNextHighestDepth());
               loadingBar.removeMovieClip();
            }
        }
    };
    
    
    
    
    Got some help this works
    
    Attached Files

  5. #4
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    I got your post. It was moderated for security purposes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial