dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [FCS3] Firefox not displaying loaded images

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    7

    [FCS3] Firefox not displaying loaded images

    BTW this is Flash CS3 Actionscript 2.0 though.
    I have created a website, http://www.stephenkiers.com/, for a client and am now testing it live on the server after testing it on my local machines fine. The problem is that for some reason the images (contained in a xml document) won't display in firefox or safari. The flash document seems to load the image, it just won't display it. The more confusing part is it works fine in IE 7 on PC.
    the code to load the images is below.
    Sorry if it messy, most of it was written by me, and some is modified from anothers work....

    Keyframe1
    Code:
    listen = new Object();
    listen.onKeyDown = function() {
    
    if (Key.getCode() == Key.LEFT) {
    ////////////////////////////////////////////////////////
    	if (picturenumber == 1) {
    		picturenumber = numberofpictures;
    		gotoAndPlay("set_variable");
    		}
    	else if (picturenumber != 1) {
    		picturenumber -= 1;
    		gotoAndPlay("set_variable");
    		} ;
    ////////////////////////////////////////////////////////
    
    } else if (Key.getCode() == Key.RIGHT) {
    
    ////////////////////////////////////////////////////////
    	if (picturenumber != numberofpictures) {
    		picturenumber += 1;
    		gotoAndPlay("set_variable");
    	}
    	else if (picturenumber == numberofpictures) {
    		picturenumber = 1;
    		gotoAndPlay("set_variable");
    	};
    ////////////////////////////////////////////////////////
    
    }
    
    };
    
    
    numberofpictures = 50;
    picturenumber = 1;
    loadVariables("pictures.asp","");
    Keyframe 30- used to confirm how many pictures there are:
    Code:
    if (picture1caption == "none")  {numberofpictures -= 1};
    if (picture2caption == "none")  {numberofpictures -= 1};
    if (picture3caption == "none")  {numberofpictures -= 1};
    if (picture4caption == "none")  {numberofpictures -= 1};
    if (picture5caption == "none")  {numberofpictures -= 1};
    if (picture6caption == "none")  {numberofpictures -= 1};
    if (picture7caption == "none")  {numberofpictures -= 1};
    if (picture8caption == "none")  {numberofpictures -= 1};
    if (picture9caption == "none")  {numberofpictures -= 1};
    if (picture10caption == "none") {numberofpictures -= 1};
    if (picture11caption == "none") {numberofpictures -= 1};
    if (picture12caption == "none") {numberofpictures -= 1};
    if (picture13caption == "none") {numberofpictures -= 1};
    if (picture14caption == "none") {numberofpictures -= 1};
    if (picture15caption == "none") {numberofpictures -= 1};
    if (picture16caption == "none") {numberofpictures -= 1};
    if (picture17caption == "none") {numberofpictures -= 1};
    if (picture18caption == "none") {numberofpictures -= 1};
    if (picture19caption == "none") {numberofpictures -= 1};
    if (picture20caption == "none") {numberofpictures -= 1};
    if (picture21caption == "none") {numberofpictures -= 1};
    if (picture22caption == "none") {numberofpictures -= 1};
    if (picture23caption == "none") {numberofpictures -= 1};
    if (picture24caption == "none") {numberofpictures -= 1};
    if (picture25caption == "none") {numberofpictures -= 1};
    if (picture26caption == "none") {numberofpictures -= 1};
    if (picture27caption == "none") {numberofpictures -= 1};
    if (picture28caption == "none") {numberofpictures -= 1};
    if (picture29caption == "none") {numberofpictures -= 1};
    if (picture20caption == "none") {numberofpictures -= 1};
    if (picture31caption == "none") {numberofpictures -= 1};
    if (picture32caption == "none") {numberofpictures -= 1};
    if (picture33caption == "none") {numberofpictures -= 1};
    if (picture34caption == "none") {numberofpictures -= 1};
    if (picture35caption == "none") {numberofpictures -= 1};
    if (picture36caption == "none") {numberofpictures -= 1};
    if (picture37caption == "none") {numberofpictures -= 1};
    if (picture38caption == "none") {numberofpictures -= 1};
    if (picture39caption == "none") {numberofpictures -= 1};
    if (picture40caption == "none") {numberofpictures -= 1};
    if (picture41caption == "none") {numberofpictures -= 1};
    if (picture42caption == "none") {numberofpictures -= 1};
    if (picture43caption == "none") {numberofpictures -= 1};
    if (picture44caption == "none") {numberofpictures -= 1};
    if (picture45caption == "none") {numberofpictures -= 1};
    if (picture46caption == "none") {numberofpictures -= 1};
    if (picture47caption == "none") {numberofpictures -= 1};
    if (picture48caption == "none") {numberofpictures -= 1};
    if (picture49caption == "none") {numberofpictures -= 1};
    if (picture50caption == "none") {numberofpictures -= 1};
    Keyframe 31
    Code:
    	 if (picturenumber == 1)  {	src = picture1;		srcname = picture1caption;}
    else if (picturenumber == 2)  {	src = picture2;		srcname = picture2caption;}
    else if (picturenumber == 3)  {	src = picture3;		srcname = picture3caption;}
    else if (picturenumber == 4)  {	src = picture4;		srcname = picture4caption;}
    else if (picturenumber == 5)  { src = picture5;		srcname = picture5caption;}
    else if (picturenumber == 6)  {	src = picture6;		srcname = picture6caption;}
    else if (picturenumber == 7)  {	src = picture7;		srcname = picture7caption;}
    else if (picturenumber == 8)  {	src = picture8;		srcname = picture8caption;}
    else if (picturenumber == 9)  {	src = picture9;		srcname = picture9caption;}
    else if (picturenumber == 10) {	src = picture10;	srcname = picture10caption;}
    else if (picturenumber == 11) {	src = picture11;	srcname = picture11caption;}
    else if (picturenumber == 12) {	src = picture12;	srcname = picture12caption;}
    else if (picturenumber == 13) {	src = picture13;	srcname = picture13caption;}
    else if (picturenumber == 14) {	src = picture14;	srcname = picture14caption;}
    else if (picturenumber == 15) {	src = picture15;	srcname = picture15caption;}
    else if (picturenumber == 16) {	src = picture16;	srcname = picture16caption;}
    else if (picturenumber == 17) {	src = picture17;	srcname = picture17caption;}
    else if (picturenumber == 18) {	src = picture18;	srcname = picture18caption;}
    else if (picturenumber == 19) {	src = picture19;	srcname = picture19caption;}
    else if (picturenumber == 20) {	src = picture20;	srcname = picture20caption;}
    else if (picturenumber == 21) {	src = picture21;	srcname = picture21caption;}
    else if (picturenumber == 22) {	src = picture22;	srcname = picture22caption;}
    else if (picturenumber == 23) {	src = picture23;	srcname = picture23caption;}
    else if (picturenumber == 24) {	src = picture24;	srcname = picture24caption;}
    else if (picturenumber == 25) {	src = picture25;	srcname = picture25caption;}
    else if (picturenumber == 26) {	src = picture26;	srcname = picture26caption;}
    else if (picturenumber == 27) {	src = picture27;	srcname = picture27caption;}
    else if (picturenumber == 28) {	src = picture28;	srcname = picture28caption;}
    else if (picturenumber == 29) {	src = picture29;	srcname = picture29caption;}
    else if (picturenumber == 30) {	src = picture30;	srcname = picture30caption;}
    else if (picturenumber == 31) {	src = picture31;	srcname = picture31caption;}
    else if (picturenumber == 32) {	src = picture32;	srcname = picture32caption;}
    else if (picturenumber == 33) {	src = picture33;	srcname = picture33caption;}
    else if (picturenumber == 34) {	src = picture34;	srcname = picture34caption;}
    else if (picturenumber == 35) {	src = picture35;	srcname = picture35caption;}
    else if (picturenumber == 36) {	src = picture36;	srcname = picture36caption;}
    else if (picturenumber == 37) {	src = picture37;	srcname = picture37caption;}
    else if (picturenumber == 38) {	src = picture38;	srcname = picture38caption;}
    else if (picturenumber == 39) {	src = picture39;	srcname = picture39caption;}
    else if (picturenumber == 40) {	src = picture40;	srcname = picture40caption;}
    else if (picturenumber == 41) {	src = picture41;	srcname = picture41caption;}
    else if (picturenumber == 42) {	src = picture42;	srcname = picture42caption;}
    else if (picturenumber == 43) {	src = picture43;	srcname = picture43caption;}
    else if (picturenumber == 44) {	src = picture44;	srcname = picture44caption;}
    else if (picturenumber == 45) {	src = picture45;	srcname = picture45caption;}
    else if (picturenumber == 46) {	src = picture46;	srcname = picture46caption;}
    else if (picturenumber == 47) {	src = picture47;	srcname = picture47caption;}
    else if (picturenumber == 48) {	src = picture48;	srcname = picture48caption;}
    else if (picturenumber == 49) {	src = picture49;	srcname = picture49caption;}
    else if (picturenumber == 50) {	src = picture50;	srcname = picture50caption;}
    
    
    
    
    
    MovieClip.prototype.fadeIn = function() {
    	this.onEnterFrame = function() {
    		if (this._alpha<100) {
    			this._alpha += 5;
    		} else {
    			delete this.onEnterFrame;
    		}
    	};
    };
    
    my_mc = new MovieClipLoader();
    preload = new Object();
    
    my_mc.addListener(preload);
    preload.onLoadStart = function(targetMC) {
    	trace("started loading "+targetMC);
    	_root.pictures._alpha = 0;
    	_root.bar._visible = true;
    	_root.loadtext._visible = true;
    };
    preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
    	_root.bar._width = (lBytes/tBytes) * _root.barwidth;
    	_root.loadtext.text = Math.round((lBytes/tBytes)*100);
    };
    preload.onLoadComplete = function(targetMC) {
    	//_root.pictures._alpha = 100;
    	_root.pictures.fadeIn();
    	_root.bar._visible = false;
    	_root.loadtext._visible = false;
    	trace(targetMC+" finished");
    };
    //default image
    
    my_mc.loadClip(src, "_root.pictures");
    _root.desctxt.text = srcname;
    Keyframe 45
    Code:
    stop();
    Please ask as many questions as needed, I would love to help you help me find an answer.

  2. #2
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Not sure how to fix that problem, but i think you should definately look at optimising the code. There's way too many if statements there... You could condense 50 lines of if statements down to two lines. Dont even need if statements.

    src = "picture" + pictureNumber; //note capitalisation of the 2nd word
    srcName = "picture" + pictureNumber + "caption";

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    7
    Why did you make the second word capitalized? Just aesthetics?

  4. #4
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Just a general rule that everyone uses. Makes it easy to read the variable names. I recommend you use it. Also i noticed in the first code block you used if(pic == 1) else if(pic != 1). There's no point putting the 2nd if. You should write it like this:

    if (picturenumber == 1) {
    picturenumber = numberofpictures;
    }
    else {
    picturenumber -= 1;
    }
    gotoAndPlay("set_variable"); //before you had this written twice when it only needs to be there once

  5. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    7
    src = "picture" + pictureNumber; //note capitalisation of the 2nd word
    srcName = "picture" + pictureNumber + "caption";
    Doesn't seem to do what it is meant too.
    for example, src is supposed to equal the variable 'picture01' but now it simply writes 'picture01' as the text there. It doesn
    t link the two variables... I hope that makes sense. I am going to look online how to fix that, unless you are able to respond and explain how to modify it. Thanks again.
    Last edited by aimdesign; 08-16-2007 at 12:19 AM.

  6. #6
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Just add this above it:

    if(pictureNumber < 10){
    pictureNumber = "0" + pictureNumber;
    }

  7. #7
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Oh now i get it... src is linking to other variables... well then maybe try [] around it like src = ["picture" + pictureNumber]; Not sure if it will work. I'd have to try a few things to get it working, but it's not hard. Might need to add 'this' infront the []. Just play around with it. U might want to think of a better way of organising this code but oh well... As long as u know not to use those if statements and everything u'll be fine eventually.
    Last edited by chur; 08-16-2007 at 12:23 AM.

  8. #8
    Junior Member
    Join Date
    Aug 2007
    Posts
    7
    the 'this[]' worked awesome. thanks for the tip, it does really shorten the code. I wasn't thinking efficient when I wrote that all...

  9. #9
    Junior Member
    Join Date
    Aug 2007
    Posts
    7
    Ohh, I might mention as well that the flash works fine on my computer(in firefox, ie and everything), it is only on the server when it messes up.

    edit: I actually just tested safari, and safari doesn't work offline. It does the same online and offline
    Last edited by aimdesign; 08-16-2007 at 01:56 AM.

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