-
Go create something, anything.
Actionscript Contest part Deux!!
Ok... here we go again.
I am eating Oreo's and milk, so pardon the grammatical errors.
I have a been working on this weather thing for a while now... It is its own swf. I am loading it into a bigger swf where it will live for now. I was having a problem getting it to work inside the bigger swf so I had to add a lockroot to the weather swf. This worked magically and the weather swf was working perfect in the bigger swf.
Until....
Until I posted it live. On the test server... or locally, it works perfectly. Suddenly the weather swf.. is not working again. It loads into the bigger swf just fine. But then it wont continue working. Here is where I think the problem is.... the weather swf loads and .as (actionscrip) file that is loaded in the same folder.... but for some reason, either that isnt loading, or the rss isnt loading into it. Not sure which.
Like I said though.... it works fine when its hosted locally. Or tested straight from flash.
Any ideas here folks??? I could surely use some help... Thanks in advance.
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
-
You'll need to post some code, or at least a link. There isn't enough info to do any debug.
Also, on a small note, the title of threads is used in the Search function of those boards. Try to have a title more self-explanatory, so members of this community have achance to find your post when dealing with a similar issue.
gparis
-
Go create something, anything.
Ok, sure thing I will post some code first thing...
Sorry about the title. Just seems like the forum is getting so crowded that you have to use a catchy title to get anyone to look, and hopefully answer. Sorry about that though... I hadn't thought about the search function thing.
.. Thanks for the reply... I will post more info on this.
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
-
Go create something, anything.
Ok. As requested... here is all of the code that I think you would want to see.
Lets start with the code on the Weather movie timeline::
Code:
_lockroot = true;
feedURL = "http://xml.weather.yahoo.com/forecastrss?p=USIL1114&u=c";
#include "//new.kingtech.net/content.as"
dispatchEvent({type:"containerInit", target:this});
function btnPressed(btn) {
btn._x += 1;
btn._y += 1;
}
function btnReleased(btn) {
btn._x -= 1;
btn._y -= 1;
}
Ok, then there is some code inside that weather clip::
Code:
if(temp){
this.txtTemperatureF.text = temp + "C";
this.txtTemperatureC.text = Math.round(temp*1.8+32) + "F";
this.txtTitle.text = "CURRENT SPRINGFIELD, IL CONDITIONS";
time = date.substring(17);
_parent.txtDate.text = "Updated: "+time;
}else if(high && low){
temp = high;
this.txtTemperatureF.text = temp + "C";
this.txtTemperatureC.text = Math.round(temp*1.8+32) + "F";
dayStr = new String(dayName(day));
this.txtTitle.text = dayStr.toUpperCase()+"'S FORECAST";
}
this.txtCondition.text = text;
objCode = this.attachMovie("icon"+code,"mcCode",this.getNextHighestDepth());
objCode._x = 10;
objCode._y = 12;
objCode.setMask(iconMask);
function dayName(day) {
switch(day) {
case "Mon":
return "Tuesday";
break;
case "Tue":
return "Wednesday";
break;
case "Wed":
return "Thursday";
break;
case "Thu":
return "Friday";
break;
case "Fri":
return "Saturday";
break;
case "Sat":
return "Sunday";
break;
case "Sun":
return "Monday";
break;
}
}
Then there is the code in the "content.as" file that the weather.swf loads::
Code:
import mx.events.EventDispatcher;
var xml_components_to_load = 0;
var xml_components_loaded = 0;
EventDispatcher.initialize(this);
this.addEventListener("containerInit",getContent);
this.addEventListener("xmlInit",getContent);
weatherDays = new Array();
var weatherDayIndex = 0;
function getContent(evt){
if(evt.type=="containerInit"){
contentDP = new XML();
contentDP.ignoreWhite = 1;
contentDP.load(feedURL);
contentDP.onLoad = loadRSSWeather;
xml_components_to_load++;
}
if(evt.type=="xmlInit"){
xml_components_loaded++;
if(xml_components_loaded==xml_components_to_load){
}
}
}
function loadRSSWeather(){
xmlData = this.firstChild.firstChild.childNodes;
todaysWeather = new Weather();
for(var i=0; i<xmlData.length; i++){
if(xmlData[i].nodeName=="item"){
itemData = xmlData[i].childNodes;
for(var j=0; j<itemData.length; j++){
if(itemData[j].nodeName.indexOf("weather")>0){
if(itemData[j].nodeName.indexOf("condition")>0){
obj = _root.attachMovie("weatherDay","todaysWeather",getNextHighestDepth(),itemData[j].attributes);
weatherDays.push(obj);
}else if(itemData[j].nodeName.indexOf("forecast")>0){
obj = _root.attachMovie("weatherDay","forecastWeather_"+j,getNextHighestDepth(),itemData[j].attributes);
obj._visible = 0;
weatherDays.push(obj);
}
}
}
}
}
dispatchEvent({type:"xmlInit", target:this});
}
function nextWeatherDay(){
weatherDays[weatherDayIndex]._visible = 0;
if(++weatherDayIndex>weatherDays.length-1){
weatherDayIndex = 0;
}
weatherDays[weatherDayIndex]._visible = 1;
}
function prevWeatherDay(){
weatherDays[weatherDayIndex]._visible = 0;
if(--weatherDayIndex<0){
weatherDayIndex = weatherDays.length-1;
}
weatherDays[weatherDayIndex]._visible = 1;
}
that should pretty much do it for what I think you would need to see. The weather.swf is being loaded into my main timeline using the loadMovie function. Like I have already said. The problem is that this works from flash... and it works on the test server... but it wont work when posted live on the net. ????
I dont know.... but look forward to anyones help on this. Thanks!!
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
-
OOP is one letter from OOPS
Assuming your live net server has some sort of server side scripting available, have you tried doing a simple load with the feed url to see if there is a domain access issue on the live server?
For example in ASP:
<%
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
Response.Write(xmlDoc.loadXML("http://xml.weather.yahoo.com/forecastrss?p=USIL1114&u=c"))
%>
will write out true is it loads or false if it does not.
-
Go create something, anything.
No.... I have definately not done that.. and unfortunately my asp guy is gone right now... so I guess I will have to wait.
But Im assuming thats not the problem. I also posted the site to my personal webspace and have the same problem there.
I mean, you could definately be right. I just wouldnt expect that from two totally different servers. I feel like it has something to do with security. I talked to someone else... they recommended this php... I just dont know what to do with it, or where the ActionScipt should be linked to it.
here is the PHP... what do you think?
Code:
<?
$url="xml.weather.yahoo.com";
//http://xml.weather.yahoo.com/forecastrss?p=USIL1114&u=c - springfield location.
$fp = fsockopen ($url, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /forecastrss?p=USIL1114&u=c HTTP/1.0\r\n";
$out .= "Host: xml.weather.yahoo.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$str = $str.fgets($fp,128);
}
fclose($fp);
}
$str=substr($str,strpos($str,'<?xml'));
print $str;
?>
Thanks for the reply by the way...
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
-
OOP is one letter from OOPS
Could be a lot of things. When I tested the ASP code I posted on my local ASP server it actually failed to load. So I am not sure what the issue is, but it could have something to do with cross domain access policies.
-
Go create something, anything.
Ok.... well that stinks. I guess I will have to wait for out programmer to get back before we can check it out for sure.
Dont think it would have anything to do with that php huh?? If I sent you that weather.fla, weather.swf would you want to place it in a movie and see if it works for you??
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
-
Go create something, anything.
OK!!! I got it. I had to change the php just slightly.... and direct flash to the php instead of the xml from yahoo. But its working now... so I'm pretty excited.
Thanks Kortex for all of your help!!!
.
"All Men are created equal, but A.M.B.I.T.I.O.N, or lack of it, soon seperates them"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|