A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Powerful Xml Dynamic Gallery V1.0 Help

  1. #1
    Member
    Join Date
    Dec 2004
    Posts
    52

    Powerful Xml Dynamic Gallery V1.0 Help

    So I recently purchased this file from Flashden. For the past two days I have been trying to figure out how to:

    Have the file start with the horizontal position.
    I know that it is the "horz" function and right now it starts as random.

    I also Would like to adjust the position of the image box...Make them load higher up in the stage.

    And finally I have some special characters in the xml. Actually just one, its an o with a line over the top and I can not get it to load dynamically with the file.

    So I have solved many of the problems and layout I had with this. Please do not think I am just trying to have you do my busy work, I am not that experienced but can usually read through things and figure it out. THANKS

    Here is the functions code. Everything that is needed to figure this out should be in here. Basically, mainly, I need to have the horz function be set to default.



    readImgBox("category1.xml");
    //
    function readCategory() {

    var xmlCategory:XML = new XML();
    xmlCategory.ignoreWhite = true;
    xmlCategory.onLoad = function(success:Boolean) {
    if (success) {
    var xCategory:XMLNode = this.firstChild;
    for (var i:Number = 0; i<xCategory.childNodes.length; i++) {
    //Read Xml Data
    var xCategoryName:String = xCategory.childNodes[i].childNodes[0].childNodes[0];
    var xCategoryXml:String = xCategory.childNodes[i].childNodes[1].childNodes[0];
    trace(xCategoryName)
    //
    categoryContainer.attachMovie("boxCategory","boxCa tegory"+i,i);
    //
    ZigoEngine.doTween(categoryContainer["boxCategory"+i],"_bezier_",{y:i*35, controlY:"180"},i*.5,"easeInOutExpo",0,function () {;
    ZigoEngine.doTween(categoryContainer,'_y',[Math.floor(Stage.height/2-categoryContainer._height/2)],0.2,"easeOutExpo");
    });
    categoryContainer["boxCategory"+i]._y = i*21;
    //write xml
    categoryContainer["boxCategory"+i].titleCat.titleTxt.text = xCategoryName;
    //bts
    categoryContainer["boxCategory"+i].bt.instanceXml = xCategoryXml;
    //
    categoryContainer["boxCategory"+i].bt.onRelease = function() {
    tempCategory = this.instanceXml;
    enableImgBox()
    removeImgBox();
    };
    }
    }
    totalCategoryDepth = i;
    };
    xmlCategory.load("categories.xml");
    }
    //
    function readImgBox(xmlGallery:String) {
    var xmlImgBox:XML = new XML();
    xmlImgBox.ignoreWhite = true;
    xmlImgBox.onLoad = function(success:Boolean) {
    if (success) {
    var xImgBox:XMLNode = this.firstChild;
    for (var i:Number = 0; i<xImgBox.childNodes.length; i++) {
    //Read Xml Data
    var xImgBoxTitle:String = xImgBox.childNodes[i].childNodes[0].childNodes[0];
    var xImgBoxTmb:String = xImgBox.childNodes[i].childNodes[1].childNodes[0].nodeValue;
    var xImgBoxImg:String = xImgBox.childNodes[i].childNodes[2].childNodes[0].nodeValue;
    var xImgBoxDesc:String = xImgBox.childNodes[i].childNodes[3].childNodes[0].nodeValue;
    imgArray.push(xImgBoxImg);
    imgTitle.push(xImgBoxTitle);
    imgDesc.push(xImgBoxDesc);
    //imgBox Props
    shadowBoxContainer.attachMovie("imgBox","imgBox"+i ,i);
    //
    shadowBoxContainer["imgBox"+i]._x = shadowBoxContainer._width/2;
    shadowBoxContainer["imgBox"+i]._y = shadowBoxContainer._height/2;
    shadowBoxContainer["imgBox"+i]._alpha = 0;
    ZigoEngine.doTween(shadowBoxContainer["imgBox"+i],'_x,_y,_alpha',[Math.floor(Math.random()*400-shadowBoxContainer["imgBox"+i]._width/2), Math.floor(Math.random()*400-shadowBoxContainer["imgBox"+i]._height/2),100],1,"easeInOutExpo");
    //Write Xml Data
    shadowBoxContainer["imgBox"+i].dateTxt.text = xImgBoxDate;
    shadowBoxContainer["imgBox"+i].titleTxt.text = xImgBoxTitle;
    loadMovie(xImgBoxTmb, shadowBoxContainer["imgBox"+i].tmbContainer);
    //bts
    shadowBoxContainer["imgBox"+i].bt.onRollOver = function() {
    this._parent.swapDepths(totalDepth+1);
    ZigoEngine.doTween(this._parent.boxShadow,'_scale' ,102,0.5,"easeInOutExpo");
    ZigoEngine.doTween(this._parent.boxShadow.boxShado wTint,'_tint',"#FFFFFF",0.5,"easeOutExpo");
    };
    shadowBoxContainer["imgBox"+i].bt.onRollOut = function() {
    ZigoEngine.doTween(this._parent.boxShadow,'_scale' ,100,0.5,"easeInOutExpo");
    ZigoEngine.doTween(this._parent.boxShadow.boxShado wTint,'_tint',"#FFFFFF",0.5,"easeOutExpo");
    };
    shadowBoxContainer["imgBox"+i].bt.instanceId = i;
    shadowBoxContainer["imgBox"+i].bt.onRelease = function() {
    ZigoEngine.doTween(this._parent.boxShadow,'_scale' ,100,0.5,"easeInOutExpo");
    ZigoEngine.doTween(this._parent.boxShadow.boxShado wTint,'_tint',"#FFFFFFF",0.5,"easeOutExpo");
    controlImgArray = this.instanceId;
    initLoadImg();
    };
    shadowBoxContainer["imgBox"+i].drag.instanceDrag = i;
    shadowBoxContainer["imgBox"+i].drag.onPress = function() {
    startDrag(shadowBoxContainer["imgBox"+this.instanceDrag]);
    };
    shadowBoxContainer["imgBox"+i].drag.onRelease = function() {
    stopDrag();
    };
    }
    }
    totalDepth = i;
    };
    xmlImgBox.load(xmlGallery);
    }
    function removeImgBox() {
    var tempArray:Array = new Array();
    var temp2Array:Array = new Array();
    var temp3Array:Array = new Array();
    //
    imgArray = tempArray;
    imgTitle = temp2Array;
    imgDesc = temp3Array;
    //
    for (var i:Number = 0; i<totalDepth; i++) {
    removeMovieClip(shadowBoxContainer["imgBox"+i]);
    }
    for (var j:Number = 0; j<totalCategoryDepth; j++) {
    ZigoEngine.doTween(categoryContainer["boxCategory"+j],"_bezier_",{y:0, controlY:"180"},1,"easeOutExpo",j*.1,function () {
    readAgain();
    });
    }
    }
    function readAgain() {
    readImgBox(tempCategory);
    //
    for (var j:Number = 0; j<totalCategoryDepth; j++) {
    removeMovieClip(categoryContainer["boxCategory"+j]);
    }
    }
    //
    //
    function controlContentImg() {

    }
    //
    function initLoadImg() {
    disableImgBox();
    //target Props
    attachMovie("targetBox","targetBox",3);
    statusRoll = false
    targetBox._x = Stage.width/2;
    targetBox._y = 0-targetBox._height;
    ZigoEngine.doTween(targetBox,'_x,_y',[Stage.width/2, Stage.height/2],0.5,"easeInOutExpo",0,function () {
    statusLoadImage = true;
    });
    //;
    targetBox.contentBox.titleText.text = imgTitle[controlImgArray];
    targetBox.contentBox.descText.text = imgDesc[controlImgArray];
    loadMovieClip(imgArray[controlImgArray]);
    //
    targetBox.shadowTarget.onRelease = function() {
    closeLoadImg();
    };
    }
    //
    function controlImg(action:String) {
    if (action == "next") {
    if (controlImgArray == totalDepth-1) {
    controlImgArray = 0;
    } else {
    controlImgArray++;
    }
    } else if (action == "back") {

    if (controlImgArray == 0) {
    controlImgArray = totalDepth-1;
    } else {
    controlImgArray--;
    }
    }
    targetBox.contentBox.titleText.text = imgTitle[controlImgArray];
    targetBox.contentBox.descText.text = imgDesc[controlImgArray];
    loadMovieClip(imgArray[controlImgArray]);
    }
    //
    function closeLoadImg() {
    ZigoEngine.doTween(targetBox,'_y',0-targetBox._height,0.5,"easeInOutExpo",0,function () {
    removeMovieClip("targetBox");
    enableImgBox();
    statusLoadImage = false;
    });
    }
    //
    function enableImgBox() {
    for (var i:Number = 0; i<totalDepth; i++) {
    shadowBoxContainer["imgBox"+i].bt.enabled = true;
    ZigoEngine.doTween(shadowBoxContainer, 'Blur_blurX,Blur_blurY', [0, 0], 1, "easeOutExpo");
    }
    }
    //
    function disableImgBox() {
    for (var i:Number = 0; i<totalDepth; i++) {
    shadowBoxContainer["imgBox"+i].bt.enabled = false;
    ZigoEngine.doTween(shadowBoxContainer, 'Blur_blurX,Blur_blurY', [5, 5], 1, "easeOutExpo");
    }
    }
    //
    function randomImgBox() {
    controlArrange = false;
    for (var i:Number = 0; i<totalDepth; i++) {
    ZigoEngine.doTween(shadowBoxContainer["imgBox"+i],"_bezier_",{x:Math.floor(Math.random()*400-shadowBoxContainer["imgBox"+i]._width/2), y:Math.floor(Math.random()*400-shadowBoxContainer["imgBox"+i]._height/2), controlY:"180"},i*.3,"easeInOutExpo");
    }
    ZigoEngine.doTween(shadowBoxContainer,'_x,_y',[Math.floor(Stage.width/2-200), Math.floor(Stage.height/2-200)],2,"easeInOutExpo");
    }
    //
    function arrange(axis:String) {
    controlArrange = true;
    //
    var row:Number = 0;
    //var col:Number = 0;
    var tempRow:Number = 0;
    var tempCol:Number = 80;
    //
    for (var i:Number = 0, col = 1; i<totalDepth; i++, col++) {
    //
    if (axis == "vert") {
    if (col%8 == 0) {
    col = 1;
    tempRow = 155;
    //tempCol = 78;
    row++;
    }
    ZigoEngine.doTween(shadowBoxContainer["imgBox"+i],"_bezier_",{x:Math.floor(row*tempRow), y:Math.floor(col*tempCol), controlY:"180"},1,"easeInOutExpo",i*.1,function () {
    ZigoEngine.doTween(shadowBoxContainer,'_x,_y',[Math.floor(Stage.width/2-shadowBoxContainer._width/2), Math.floor(Stage.height/2-shadowBoxContainer._height/2)],0.2,"easeInOutExpo");
    });
    } else if (axis == "horz") {
    if (col%3 == 0) {
    col =1;
    tempRow = 300;
    //tempCol = 78;
    row++;
    }
    ZigoEngine.doTween(shadowBoxContainer["imgBox"+i],"_bezier_",{x:Math.floor(row*tempRow), y:Math.floor(col*tempCol), controlY:"-360"},1 ,"easeInOutExpo",i*.1,function () {
    ZigoEngine.doTween(shadowBoxContainer,'_x,_y',[Math.floor(Stage.width/2-shadowBoxContainer._width/2), Math.floor(Stage.height/2-shadowBoxContainer._height/2)],0.2,"easeInOutExpo");
    });
    }
    }
    }
    //
    function loadMovieClip(externalTarget:String) {
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var listenerLoad:Object = new Object();
    listenerLoad.onLoadStart = function(target:MovieClip) {
    targetBox.imgTarget._alpha = 0;
    };
    listenerLoad.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
    var percentImg = Math.round(bytesLoaded/bytesTotal*100);
    targetBox.percent.text = percentImg+"%";
    targetBox.percentShadow.text = percentImg+"%";
    };
    listenerLoad.onLoadComplete = function(target:MovieClip):Void {
    ZigoEngine.doTween(targetBox.imgTarget,"_alpha",10 0,1,"easeInOutExpo");
    targetBox.percent.text = "";
    targetBox.percentShadow.text = "";
    };
    mcLoader.addListener(listenerLoad);
    mcLoader.loadClip(externalTarget,targetBox.imgTarg et);
    }

  2. #2
    Member
    Join Date
    Dec 2004
    Posts
    52
    please help, need this asap....thanks

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