Results 1 to 7 of 7

Thread: XML Flash gallery problem

  1. #1
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default XML Flash gallery problem

    Ok so I am loading a "portfolio.swf" into my "index.swf". I have my gallery loading my XML and it parses just fine. My problem is when I'm trying to have a preloader that is located in the _root of the index.swf, using loadMovie(image[this.id]); isn't finding the image or .swf I'm try to add to stage.

    Here are some snippets of the code that I'm using in each section:

    This is the portfolio.swf loading XML:
    Code:
    onEnterFrame = function () {
    	loading = (image[this.id]).getBytesLoaded();
    	filesize = (image[this.id]).getBytesTotal();
    };
    if (filesize>10) {
    	percentage = Math.round((loading/filesize)*100);
    } else {
    	percentage = 0;
    }
    percentage = _root.preloader_mc.displayPercentage.text;
    
    /////////////Load Category Data/////////////
    images = new XML();
    images.ignoreWhite = true;
    images.onLoad = function(success) {
    	if (success) {
    		xmlNode = this.firstChild;
    		image = [];
    		thumb = [];
    		roll_over = [];
    		Xloc = [];
    		Yloc = [];
    		_global.desc = [];
    		total = xmlNode.childNodes.length;
    		for (var i = 0; i<total; i++) {
    			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    			thumb[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
    			_global.desc[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
    			roll_over[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
    			Xloc[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
    			Yloc[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
    			holder_mc.attachMovie("thumb","butj"+i,i+999);
    			holder_mc["butj"+i].thumb_mc._alpha = 0;
    			holder_mc["butj"+i].id = i;
    			holder_mc["butj"+i]._x = i%5*140+25;
    			holder_mc["butj"+i]._y = Math.floor(i/5)*90;
    			holder_mc["butj"+i].thumb_mc.loadMovie(thumb[i],1);
    			MoveNav = new Tween(holder_mc["butj"+i].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+i].thumb_mc._alpha, 100, 1, true);
    			holder_mc["butj"+i].onRollOver = function() {
    				MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 50, 0.5, true);
    			};
    			holder_mc["butj"+i].onRollOut = function() {
    				MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 100, 3, true);
    			};
    			holder_mc["butj"+i].onRelease = function() {
    				_global.desc[z] = _global.desc[this.id];
    				_global.image[1] = _global.image[this.id];
    				_root.big_symbol._width = Stage.width+30;
    				_root.big_symbol._height = Stage.height+30;
    				_root.big_symbol._x = 0;
    				_root.big_symbol._y = 0;
    				_root.big_symbol._visible = true;
    				trace(image[this.id]);
    				_root.preloader_mc.gotoAndStop(2);
    				var tweenAlphaPreloader:Tween = new Tween(_root.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
    				tweenAlphaPreloader.stop();
    				contentLoaded = function () {
    					tweenAlphaPreloader.start();
    					tweenAlphaPreloader["onMotionFinished"] = function () {
    					
    					};
    				};
    And here is what I have the preloader doing:
    Code:
    if (percentage == 100) {
    	var tweenAlphaPreloader:Tween = new Tween(_parent.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
    	tweenAlphaPreloader.stop();
    	tweenAlphaPreloader.start();
    	tweenAlphaPreloader["onMotionFinished"] = function () {
    		_parent.swfHolder.loadMovie(image[this.id]);
    	};
    }
    When I play the move like this, I'm getting "undefined" for the loadMovie.

    Any help is greatly appreciated!
    Last edited by windir; 04-21-2009 at 11:05 PM.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Code:
    _parent.swfHolder.loadMovie(image[this.id]);
    should probably be

    Code:
    _parent.swfHolder.loadMovie("portfolio.swf");

  3. #3
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No, what I'm loading are items in my portfolio I want to load. They are already loading dynamically as thumbnails.

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    So, what you're doing is preloading the items in portfolio.swf from inside index.swf?

  5. #5
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The preloader I am loading the gallery items to the holder in index.swf

    Oh, I'm using the same preloader that I am to load other parts of the site. Maybe I'll just add another one to the portfolio.swf. I was try to use one for the whole site.
    Last edited by Snookerman; 04-22-2009 at 01:49 PM. Reason: merged posts

  6. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    yeah, I have no idea what you're trying to do. It's obviously a scope issue. You're calling variables that haven't been set yet.

    My question would be what do you expected the highlighted to be equal to?
    Code:
    _parent.swfHolder.loadMovie(image[this.id]);

  7. #7
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm just trying to get the external swf that is clicked to load. Probably would help to post what the XML setup is. Here is a sample:

    Code:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <Gallery/images header="PHOTO GALLERY">
      <pic>
        <image>portfolio_content/flash/full/1.swf</image>
        <thumb>portfolio_content/flash/thumbs/1.jpg</thumb>
        <description>
          Here is the content
        </description>
    	<roll_over>Picture 1</roll_over>
    	<Xloc>150</Xloc>
    	<Yloc>150</Yloc>
      </pic>
    </gallery>
    Does that help any?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •