A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [F8] weird problem! inconsistant code :(

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Location
    london/ny
    Posts
    126

    [F8] weird problem! inconsistant code :(

    hey
    oh dear i have a really dumb problem that i've never come across before. basically i have a load of thumbnails that launch a big image to load in and once it has it positions itself. a close button also comes up which sends everything back to the default state. all works fine. UNTIL i test it in a browser. sometimes it works fine, sometimes the images come up and do not position themselves! no consistency to the problem, it's not like it's every other time or anything like that, just sometimes it happens, sometimes it doesn't. has anyone ever had a problem like that before - and what was causing it???!!!

  2. #2
    Senior Member Alluvian's Avatar
    Join Date
    Jun 2006
    Posts
    967
    You say 'launch a big image', how are you 'launching' it?

    My first guess it that there is a loading delay and the following code does not work unless the image is loaded first. Something that may be near instant locally but not so from a server. But it would help to know how you are getting your big image to the stage.

  3. #3
    Senior Member
    Join Date
    Mar 2005
    Location
    london/ny
    Posts
    126
    i'm using loadMovie, then using an onEnterFrame to check if its loaded, if it is then it deletes the onEnterFrame and runs the functions to position the image and fade the image in. here's my code:

    Code:
    tempWedge.onRelease = function(){
    			launchImage();
    			 bigView = true;
    			 empty._alpha = 0;
    			loadMovie("illustration/"+_root.whichImage+".jpg", empty);
    			onEnterFrame = function(){
    			if (empty._framesloaded == empty._totalframes){
    				delete onEnterFrame;
    				posEmpty();
    				Tweener.addTween(empty,{_alpha:100, time:0.4, transition:"easeInOutSine"});
    				addClose();
    			}
    		}
    the launchImage function doesn't launch the image, it just prepares the stage for the image. empty is the empty clip on the stage i'm loading my images into. does that help at all? thanks for replying this is frying my brain now!

  4. #4
    Senior Member
    Join Date
    Mar 2005
    Location
    london/ny
    Posts
    126
    i now think that this onEnterFrame stuff is not the best way to figure that the image has loaded in. seems that's the glitchy bit. going to look for another solution - any pointers anyone?

  5. #5
    Senior Member
    Join Date
    Mar 2005
    Location
    london/ny
    Posts
    126
    ok have solved it - have changed my code to this:

    Code:
    tempWedge.onRelease = function(){
    			launchImage();
    			bigView = true;
    			var myMCL = new MovieClipLoader();
    			myMCL.onLoadInit = function (empty){
       				posEmpty();
    				addClose();
    				empty._alpha = 0;
    				Tweener.addTween(empty,{_alpha:100, time:0.4, transition:"easeInOutSine"});
    			}
    works great. phew!

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