A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: The preloader question, but I need help please (MX 2004)

Hybrid View

  1. #1
    Senior Member
    Join Date
    Mar 2003
    Location
    san francisco
    Posts
    106

    The preloader question, but I need help please (MX 2004)

    I haven't used flash since Flash 5 and I just got MX 2004. I'm trying to make a preloader that loads external jpegs into a empty container with a action scripted percentage bar. I'm trying to make the preloader as simple as possible. Here is what I have so far but something is wrong I just can't see the problem.
    --------------------------------------------------------------------------------------
    • Code on _root

    baseSize = container.getBytesTotal();

    --------------------------------------------------------------------------------------
    • Code on empty container

    onClipEvent (load) {
    loading = true;
    }
    onClipEvent (enterFrame) {
    if (loading) {
    if (this.getBytesTotal()>_root.baseSize) {
    percent = this.getBytesLoaded()/this.getBytesTotal()*100;
    trace (percent);
    _root.loadingBar.bar._xscale = percent;
    if (percent == 100) {
    loading = false;
    _root.loadingBar._visible = false;
    }
    }
    }
    }

    --------------------------------------------------------------------------------------
    •_code on loadingBar

    onClipEvent (load) {
    _visible=fasle;
    }

    --------------------------------------------------------------------------------------
    • code on bar

    onClipEvent (load) {
    this._xscale = 0;
    }

    --------------------------------------------------------------------------------------

    • code on the button

    on (press) {
    _root.container.loadMovie("external_image.jpg");
    _root.loadingBar.bar._xscale = 0;
    _root.loadingBar._visible = true;

    --------------------------------------------------------------------------------------

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    GParis answered you on that one!

    Think you'll get a better anser on this forum?

  3. #3
    Senior Member
    Join Date
    Mar 2003
    Location
    san francisco
    Posts
    106
    I understand and know gparis see's the problem and he did answer me but I need a little more direction to help me through this.

    After reading what gparis wrote it seems I need to figure out how to script
    if (this.getBytesTotal()>THE TOTAL BYTES IN THE CONTAINER)

    but right now the script is

    if (this.getBytesTotal()>_root.baseSize)

    basically saying the same this

    if (this.getBytesTotal()>this.getBytesTotal)

    I'm just looking for someone to push me a little harder in the right direction.

    Thanks,

    M

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    GParis is a she!

    Why so many ifs?

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This alone works fine for me...
    Code:
    onClipEvent (load) {
    //	loading = true;
    }
    onClipEvent (enterFrame) {
    	//if (loading) {
    	//if (this.getBytesTotal()>_root.baseSize) {
    	percent = this.getBytesLoaded()/this.getBytesTotal()*100;
    	trace (percent);
    	_root.loadingBar.bar._xscale = percent;
    	if (percent == 100) {
    		//loading = false;
    		_root.loadingBar._visible = false;
    //}
    //}
    	}
    }

  6. #6
    Senior Member
    Join Date
    Mar 2003
    Location
    san francisco
    Posts
    106
    Really Gparis is a SHE — ooops... I never knew girls could be so talented. I've been enlightened. I don't have flash on this computer but I'll try omitting the code you // out.

    Thanks,

    M

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