A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Not getting how to load XML elements onRollover ...

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    15

    Question Not getting how to load XML elements onRollover ...

    This should be easy however i am not getting it...

    I have five movie clips, for example, mc1, mc2, mc3, mc4, mc5. onRollover i want it to fetch content from XML and display in toolTipMC movie clip (toolTipMC.img.imgHolder, toolTipMC.title, toolTipMC.detail). Also how to unload when i rollout?

    and my XML file:-

    <movieclips>
    <movieclip image="images/mc1.jpg" title="MC1" detail="This is MC1"></movieclip>
    <movieclip image="images/mc2.jpg" title="MC2" detail="This is MC2"></movieclip>
    <movieclip image="images/mc3.jpg" title="MC3" detail="This is MC3"></movieclip>
    <movieclip image="images/mc4.jpg" title="MC4" detail="This is MC4"></movieclip>
    <movieclip image="images/mc5.jpg" title="MC5" detail="This is MC5"></movieclip>
    </movieclips>


    Actionscript :-


    mc = mainMap.map.pan;
    toolTipMC._visible = false;
    detailMC._visible = false;
    detailMC.detail.autoSize = true;
    for (i in mc) {
    if (typeof (mc[i]) == "movieclip" && i != "click") {
    myBtn = mc[i];
    myBtn._alpha = 0;
    this.useHandCursor = false;
    myBtn.txt = titles[j];
    myBtn.txt2 = detials[j];
    myBtn.img = images[j].img;

    var x:XML = new XML();
    x.ignoreWhite = true;

    var images:Array = new Array();
    var titles:Array = new Array();
    var details:Array = new Array();

    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for(j=0;j<photos.length;j++) {
    images.push(photos[j].attributes.url);
    titles.push(photos[j].attributes.title);
    detials.push(photos[j].attributes.detail);
    }
    whoIsOn = i;
    }

    x.load("data.xml");

    myBtn.onRollOver = function() {
    if (miniMap._visible) {
    this.useHandCursor = false;
    var point = {x: (this.mouseX ), y: (this.mouseY)};
    this.localToGlobal(point);
    toolTipMC._x = point.x;
    toolTipMC._y = point.y;

    toolTipMC._visible = true;

    toolTipMC.img.imgHolder.loadMovie(this.img);
    toolTipMC.tip.text = this.txt;
    toolTipMC.detail.text = this.txt2;
    }else{
    this.useHandCursor = false;
    }

    };

    myBtn.onRollOut = function() {
    toolTipMC._visible = false;
    };
    myBtn.onPress = function() {
    if (miniMap._visible) {
    toolTipMC._visible = true;
    slider.setValue(100);
    PanMapCenterTo(this._x - (baseSize.width / 4) + this._width, this._y - (baseSize.height / 4) + this._height);
    }
    };

    };
    }

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    15
    It gives an error on Rollover Error opening URL 'file:///PC/Users/tarunar/Desktop/Folder/undefined'

Tags for this Thread

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