dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: F[8] - Firefox Troubles! - Need Help

  1. #1
    Senior Member frostbite's Avatar
    Join Date
    Aug 2003
    Location
    Colorado
    Posts
    666

    F[8] - Firefox Troubles! - Need Help

    I am calling images into flash through XML.

    Now in Firefox and Safari, the images load fine and everything goes well, except the preloader for the images never shows up, and it doesn't fade in.

    However, in IE, everything works perfectly.

    What can I do to my code to make it work with Firefox and Safari as well as IE?

    Here is the part of my code that seems to be failing. When the image is loaded, the preloader SHOULD progress to frame 100, at which time the image SHOULD fade in.
    Code:
    this._parent.onEnterFrame = function() {
    	loaded = this.image.getBytesLoaded();
    	total = this.image.getBytesTotal();
            frame = Math.round((loaded/total)*100);
    	this.preloader._visible = true;
    	if (frame < 99) {
    		this.preloader.gotoAndStop(frame);
    	} else {
    		this.preloader._visible = false;
    		alphaTween = new mx.transitions.Tween(image, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 2, true);
    		delete this.onEnterFrame;
    		this.preloader.gotoAndStop(1);
           }
    };
    The preloader is a bar that goes from frame 1 to 100. So as the image loads, the movie clip preloader should progress.
    Last edited by frostbite; 03-21-2007 at 02:48 PM.
    Yarrg Matey!

  2. #2
    Senior Member frostbite's Avatar
    Join Date
    Aug 2003
    Location
    Colorado
    Posts
    666
    Here is the rest of the code used to display the images from the XML file...

    On the first frame...
    Code:
    _global.a_th = 55;
    _global.columns = 1;
    _global.rows = 10;
    var PhotoAlbum = {thumbs:[]};
    photo_xml = new XML();
    photo_xml.ignoreWhite = true;
    This code is on the next frame...
    Code:
    photo_xml.onLoad = function() {
    	media1_th.html = true;
    	media1_th.htmlText = "<p align=\"center\"></p>";
    	Media1_Photos(0);
    };
    _global.Media1_Photos = function(carregar) { 
    	var photos = photo_xml.firstChild.childNodes;
    	var p_thumbs = photo_xml.firstChild.attributes.thumbs, p_photos = photo_xml.firstChild.attributes.media1;
    	var i = carregar;
    	for (var r:Number = 0; r<rows; r++) {
    		for (var c:Number = 0; c<columns && i<photos.length; c++, i++) {
    			var thumb = media1_th.createEmptyMovieClip("thumb_"+i, i);
    			PhotoAlbum.thumbs.push(t);
    			thumb._x = r*a_th;
    			thumb.createEmptyMovieClip("photos", 1);
    			thumb.photos.loadMovie("pages/galleries/media1/"+p_thumbs+"/"+photos[i].attributes.thumb);
    			thumb.dimensions = photos[i].attributes;
    			thumb.onRelease = function() {
    				media1_photo._parent.image.unloadMovie();
    				media1_photo.dimensions = this.dimensions;
    				media1_photo.onEnterFrame = function() {
    					caption_txt = this.dimensions.captions;
    					this._width += (this.dimensions.width-this._width)/4;
    					this._height += (this.dimensions.height-this._height)/4;
    					if (Math.round(this._width) == Math.round(this.dimensions.width) && Math.round(this._height) == Math.round(this.dimensions.height)) {
    						this._width = this.dimensions.width;
    						this._height = this.dimensions.height;
    						delete this.onEnterFrame;
    						this._parent.createEmptyMovieClip("image", 1);
    						this._parent.image._x = this._x-(this._width/2);
    						this._parent.image._y = this._y-(this._height/2)-13;
    						this._parent.image.loadMovie("pages/galleries/media1/"+p_photos+"/"+this.dimensions.media1_bw);
    						delete this.onEnterFrame();
    						
    						var loaded:Number = 0;
    						var total:Number = 0;
    						var frame:Number = 0;
    						this._parent.onEnterFrame = function() {
    							loaded = this.image.getBytesLoaded();
    							total = this.image.getBytesTotal();
    							frame = Math.round((loaded/total)*100);
    							this.preloader._visible = true;
    							if (frame < 99) {
    								this.preloader.gotoAndStop(frame);
    							} else {
    								this.preloader._visible = false;
    								alphaTween = new mx.transitions.Tween(image, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 2, true);
    								delete this.onEnterFrame;
    								this.preloader.gotoAndStop(1);
    							}
    						};
    						
    					}
    				};
    			};
    		}
    	}
    };
    photo_xml.load("pages/galleries/media1/photos.xml");
    Yarrg Matey!

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