dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: onLoad w/scenes

  1. #1
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289

    onLoad w/scenes

    I am having a heck of a time. Does the 'onLoad' event take place at Scene 1, Frame 1 regardless of placement (ie, scene 2 frame 1?). When I test the "scene", I get totally different results as when I test "Movie". I read somewhere here that it's not recommended to have more than one scene, true?

    Forgot to add that testing "scenes" is just a time saver, rather than testing the whole movie
    Regards,

    Ron

  2. #2
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    I don't use scenes anymore... true, alot of people don't recommend them.

    onLoad takes place after the object has loaded. You must define the onLoad event before the object is loaded in order for it to function.

  3. #3
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    Thanks gSOLO, I think I'm done with scenes myself. Just made things easier.

    But I don't think this will solve my prob (may need to be in ActionScript sec.). Got a simple function to color a loader and display % in textbox. The problem is, even though the initial function is to set the bar pix to 0, this ain't happening. The bar loads full on [the] Load. Am I doing something backwards here. The textbox is blank, as advertised.



    onLoad = function() {
    myMusicLoading = 0;
    _root.loadBar._xscale = myMusicLoading;
    }
    onEnterFrame = function() {
    myMusicBytesTotal = _root.myMusic.getBytesTotal();
    myMusicBytesLoaded = _root.myMusic.getBytesLoaded();
    if (preloadNow == 1 && myMusicBytesLoaded>0) {
    myMusicLoading = Math.round((myMusicBytesLoaded/myMusicBytesTotal)*100);
    if (myMusicLoading == 100) {
    preloadNow = 0;
    }
    _root.percentLoadedText = myMusicLoading+"%";
    _root.loadBar._xscale = myMusicLoading;
    }

    }
    Regards,

    Ron

  4. #4
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789

    try this

    Code:
    _root.loadBar._xscale = 0;
    this.onEnterFrame = function() {
    	myMusicBytesTotal = _root.myMusic.getBytesTotal();
    	myMusicBytesLoaded = _root.myMusic.getBytesLoaded();
    	if (preloadNow && myMusicBytesLoaded > 0) {
    		myMusicLoading = Math.round((myMusicBytesLoaded / myMusicBytesTotal) * 100);
    		if (myMusicLoading == 100) {
    			preloadNow = false;
    			delete this.onEnterFrame;
    		}
    		_root.percentLoadedText = myMusicLoading + "%";
    		_root.loadBar._xscale = myMusicLoading;
    	}
    };
    where is this code? are you preloading myMusic? where is preloadNow defined?

  5. #5
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    where is this code?
    {was} on Scene 2 Frame 1. In the process of converting to one scene.
    are you preloading myMusic?
    Got an array loading seperate mp3's.
    where is preloadNow defined?
    On the load button for the array. Changes to "1" when calling. I can change to "true"

    I'll try your suggestion and get back. I think I'm liking the "delete this.onEnterFrame" also! Was probably going to be another question down the road.
    Regards,

    Ron

  6. #6
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    Thanks for the help. Working beautifully. Once the preloader disappeared, I was back on track. My next question was gonna be "how do I get it to reset?" Just told the button to replay the frame. Thanks a million, I can move on with my day now
    Regards,

    Ron

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