Adrian Florescu
Adrian Florescu

Reputation: 4492

Flash - Get links URL from external XML/TXT file

Hello,

I bought a flash template who uses this code for links in the header

onClipEvent (load) {
    num = 2;
    _parent.ti1.gotoAndStop(num);
    _parent.ti2.gotoAndStop(num);
}
on (rollOver) {
    if (_root.link<>num) {
    _parent.gotoAndPlay("s1");
    }
}
on (releaseOutside, rollOut) {
    if (_root.link<>num) {
    _parent.gotoAndPlay("s2");  
    }
}
on (release) {
    if (_root.link<>num) {
        _root.link_prev = _root.link;
        _parent._parent["item"+_root.link].gotoAndPlay("s2");
        _root.link = num;
        getURL("./page-name/");
    }
}

What I want is to be able to modify the page URL from an external file (xml or txt). I want just an external file, and here, on the AS of the button to modify just the line number of where to get the link from external file.

Thank you

Upvotes: 1

Views: 1383

Answers (1)

apscience
apscience

Reputation: 7253

Flash can read variables from text files. However, if the text file is on a different domain than the site you are hosting the swf, you need to place a crossdomain.xml file on the root of the domain containing the text file.

onClipEvent (load) {
    num = 2;
    _parent.ti1.gotoAndStop(num);
    _parent.ti2.gotoAndStop(num);
    this.loadVariables("external.txt");
}

The text file called external.txt could be:

&goToUrl=urlHere

And then

getURL(goToUrl);

Upvotes: 1

Related Questions