dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: _rotation problems in preloader

  1. #1
    *insert clever title* SergeantK's Avatar
    Join Date
    Nov 2004
    Location
    Akron, Ohio
    Posts
    506

    _rotation problems in preloader

    Man, I made a preloader.... and the rotating ball won't rotate!!! It is an MC with an instance name, pball...

    On the first frame of the preloader, I have the code:
    code:

    bytes_loaded = Math.round(_root.getBytesLoaded());
    bytes_total = Math.round(_root.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    health = 100 - Math.round(getPercent*100);
    pball._rotation += getPercent;
    if (bytes_loaded == bytes_total) {
    this.gotoAndStop(3);
    }


    And on the second frame, of course, gotoAndPlay(1);

    What went wrong?


  2. #2
    Member
    Join Date
    Feb 2005
    Posts
    37
    I kinda am trying out the same thing (a few post down).

    One thing I screwed up with at first was calling my MC correctly. Also, make sure your Action Script is on the movieclip, not the frame. If it is on the movieclip try

    this._rotation or just _rotation

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    285
    Put this in frame 1. You won't need a frame 2.

    Code:
    onEnterFrame = function () {
    	bytes_loaded = Math.round(_root.getBytesLoaded());
    	bytes_total = Math.round(_root.getBytesTotal());
    	getPercent = bytes_loaded / bytes_total;
    	health = 100 - Math.round(getPercent * 100);
    	pball._rotation += getPercent;
    	if (bytes_loaded == bytes_total) {
    		this.gotoAndStop(3);
    		delete onEnterFrame;
    	}
    };
    stop()
    enjoy

    tutash

  4. #4
    Senior Member Ryanw2626's Avatar
    Join Date
    Dec 2002
    Location
    NY
    Posts
    190
    in this case, would pball be the loading animation clip? And does health actually have to be a movie clip or is it there for reference?

    Ryan Wilson
    Creative Director
    3rd Lounge Inc
    http://www.3rdlounge.com

  5. #5
    *insert clever title* SergeantK's Avatar
    Join Date
    Nov 2004
    Location
    Akron, Ohio
    Posts
    506
    The health thing is a text countdown to when the movie is loaded.


  6. #6
    Member
    Join Date
    Aug 2001
    Posts
    53
    In your current code, "getPercent" is evaluating to a number less than 1.

    You need to use:
    pball._rotation += Math.round(getPercent * 100);

  7. #7
    *insert clever title* SergeantK's Avatar
    Join Date
    Nov 2004
    Location
    Akron, Ohio
    Posts
    506
    Oops.... Thanks.

    I can't believe i didntr see that


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