# Problems loading news content through external SWF

**URL:** <https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652>\
**Category:** flash\
**Created:** [April 23, 2006, 8:56am UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652 "2006-04-23T08:56:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlazinHustla](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@BlazinHustla](https://forum.kirupa.com/u/BlazinHustla)\
**Post date:** [April 23, 2006, 8:56am UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/1 "2006-04-23T08:56:29Z")

</div>

What up everybody, I hope someone can help me on this problem I’ve been workin on for the past week… I’ve tried different things to fix this but no luck…

The news content loads up perfectly fine when u pull up the swf directly… for example:  
[http://flaremedia.com/dalab/ral/newz02.swf](http://flaremedia.com/dalab/ral/newz02.swf)

but once its being loaded through the mainframe, we start having issues…  
[http://flaremedia.com/dalab/ral/home.html](http://flaremedia.com/dalab/ral/home.html)  
Click on the News button

Here’s the link to download the News FLA file:  
[http://flaremedia.com/dalab/ral/news.fla](http://flaremedia.com/dalab/ral/news.fla)

Now I know this could be something simple such as Path Issues… but I’ve never been 2 much of a code guy, but I would greatly appreciate if someone would drop some knowledge on this matter… Thank you.

JH

---

<div class="post-metadata">

**Author:** ![phorte](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@phorte](https://forum.kirupa.com/u/phorte)\
**Post date:** [April 23, 2006, 10:53am UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/2 "2006-04-23T10:53:09Z")

</div>

you probably want to make sure all your variables are reffered to within the local timeline. in other words, dont use \_root, cause when u load your swf into another swf \_root becomes the main timesline of loading swf. So if you refer to all your variables as this, then all ur variables should stay local to your loaded swf.

Did that make any sense, cause it didnt to me… :huh: 😃

---

<div class="post-metadata">

**Author:** ![BlazinHustla](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@BlazinHustla](https://forum.kirupa.com/u/BlazinHustla)\
**Post date:** [April 23, 2006, 7:22pm UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/3 "2006-04-23T19:22:15Z")

</div>

Ok I knew it had something to do with the \_root it in the actionscript… so now my question is… do I go through all the action script and delete the \_root out of it, or do I replace it with something else?

For example here is some of the code from the actionscript of the news scroller:  
stop();  
this.\_lockroot = true;  
\_root.topPlay = true;

newsTitle = new Array();  
newsText = new Array();  
newsImg = new Array();  
newsUrl = new Array();

xmlStr=new String(xml);  
if(xmlStr==“undefined”)  
xml=“config.xml”;

// xml parser  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.load(xml+"?"+(new Date()).getTime());  
[//xmlData.load](https://xmlData.load)(xml);

xmlData.onLoad = function(success) {

```
// get configuration string
config = this.firstChild.firstChild;

_root.titleFace = config.childNodes[0].childNodes[0].firstChild.nodeValue;    
_root.titleColor = "0x"+config.childNodes[0].childNodes[1].firstChild.nodeValue;    
_root.titleDecoration = config.childNodes[0].childNodes[2].firstChild.nodeValue;

_root.fontTopFace = config.childNodes[1].childNodes[0].firstChild.nodeValue;    
_root.fontTopSize = config.childNodes[1].childNodes[1].firstChild.nodeValue;
_root.fontTopColor = "0x"+config.childNodes[1].childNodes[2].firstChild.nodeValue;    
_root.fontDecoration = config.childNodes[1].childNodes[3].firstChild.nodeValue;    

// target window of the url
_root.targetTop = config.childNodes[2].childNodes[0].firstChild.nodeValue;    
// font color when the mouse is over the link
_root.aTitleColor = "0x"+config.childNodes[2].childNodes[1].firstChild.nodeValue;
_root.aTextColor = "0x"+config.childNodes[2].childNodes[2].firstChild.nodeValue;

_root.bgInColor = "0x"+config.childNodes[3].childNodes[0].firstChild.nodeValue;    
_root.bgOutColor = "0x"+config.childNodes[3].childNodes[1].firstChild.nodeValue;
_root.animBgInColor = "0x"+config.childNodes[3].childNodes[2].firstChild.nodeValue;    
_root.animBgOutColor = "0x"+config.childNodes[3].childNodes[3].firstChild.nodeValue;
_root.imgBgColor = "0x"+config.childNodes[3].childNodes[4].firstChild.nodeValue;
_root.stageBgColor = "0x"+config.childNodes[3].childNodes[5].firstChild.nodeValue;
// delay
_root.delay = config.childNodes[4].firstChild.nodeValue;    

// news
news = config.childNodes[5];
for(i=0;i&lt;news.childNodes.length;i++) {
        j=0;
    // get the news title
    if(news.childNodes*.childNodes[0].nodeName ne "title") 
        newsTitle* = "null";
    else {
        newsTitle* = news.childNodes*.childNodes[j].firstChild.nodeValue;
        j++;
    }
    // get the news text
    if(news.childNodes*.childNodes[j].nodeName ne "text") 
        newsText* = "null";
    else {
        newsText* = news.childNodes*.childNodes[j].firstChild.nodeValue;
        j++;
    }
    // get the news image
    if(news.childNodes*.childNodes[j].nodeName ne "img") 
        newsImg* = "null";
    else {
        newsImg* = news.childNodes*.childNodes[j].firstChild.nodeValue;
        j++;
    }
    
    newsUrl* = news.childNodes*.childNodes[j].firstChild.nodeValue;
    if(newsUrl*.indexOf("@") != -1)
        newsUrl* = "mailto:"+newsUrl*;
}

play();

```

}

So what would I have to do to fix the paths in this code?

Thanks

---

<div class="post-metadata">

**Author:** ![phorte](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@phorte](https://forum.kirupa.com/u/phorte)\
**Post date:** [April 24, 2006, 3:24am UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/4 "2006-04-24T03:24:56Z")

</div>

was just looking up that \_lockroot thing, seams that should solve your problem. But seeing as youve got it there, and its still not working, im not sure. I will take a look at your fla, and see what i can work out.

EDIT:  
Try placing \_this.lockroot on the very first frame on the main timeline.

---

<div class="post-metadata">

**Author:** ![Gupps](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Gupps](https://forum.kirupa.com/u/Gupps)\
**Post date:** [April 24, 2006, 1:50pm UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/5 "2006-04-24T13:50:05Z")

</div>

i think it should be placed on the newz02 timeline and not the main timeline

---

<div class="post-metadata">

**Author:** ![BlazinHustla](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@BlazinHustla](https://forum.kirupa.com/u/BlazinHustla)\
**Post date:** [April 24, 2006, 7:29pm UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/6 "2006-04-24T19:29:19Z")

</div>

I tried aussie’s and Gupps suggestions, but it didn’t work… I put it in the very first frame of the News timeline… the actual news ticker script is inside a movieclip in the News section… am I missing something here??

---

<div class="post-metadata">

**Author:** ![Gupps](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Gupps](https://forum.kirupa.com/u/Gupps)\
**Post date:** [April 24, 2006, 7:55pm UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/7 "2006-04-24T19:55:20Z")

</div>

try putting it inside that movie clip

---

<div class="post-metadata">

**Author:** ![BlazinHustla](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@BlazinHustla](https://forum.kirupa.com/u/BlazinHustla)\
**Post date:** [April 24, 2006, 11:20pm UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/8 "2006-04-24T23:20:49Z")

</div>

Inside that movieclip… the first 2 keyframes has actions…

the first keyframe actions starts off looking like this:  
stop();  
this.\_lockroot = true;  
\_root.topPlay = true;

newsTitle = new Array();  
newsText = new Array();  
newsImg = new Array();  
newsUrl = new Array();

then the second keyframe actions starts off looking like:  
stop();

// set the new parameters  
aColor = new Color(bg.bgIn);  
aColor.setRGB(\_root.bgInColor);

What should I do? I know it has to be something really simple.

---

<div class="post-metadata">

**Author:** ![BlazinHustla](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@BlazinHustla](https://forum.kirupa.com/u/BlazinHustla)\
**Post date:** [April 25, 2006, 4:09am UTC](https://forum.kirupa.com/t/problems-loading-news-content-through-external-swf/186652/9 "2006-04-25T04:09:51Z")

</div>

:skull:
