我正在尝试将 flickr 集成到我创建的天气应用程序(yahoo 天气 api)中,并决定首先利用 flickrGrabber (http://blog.organa.ca/?p=19)作为起点。我的天气应用程序和 flickrGrabber 都可以工作,但是在初始加载后更新 flickrGrabber 对我来说非常具有挑战性。
初始图像是通过由名为 flickrLocationName 的变量设置的搜索词来提取的,我能够在输入新的邮政编码时成功更新变量值,但是我似乎无法让 flickrGrabber 卸载并删除它。重新加载新值。我的 flickrGrabber 代码位于 documentAS 层上。 flickrGrabber 类可以在 Src 文件夹中找到,var flickrLocationName 从 WeatherObject 类中设置,该类也可以在 Src 文件夹中找到。
您可以通过访问此链接了解我的意思:
http://truimage.biz/WAS400/WeatherApp/Deploy/weatherApp.html
当然我的源码可以在这里下载:
http://truimage.biz/WAS400/weatherApp.zip
非常感谢任何帮助。这是一些示例代码:
import flickrGrabber;
var apiKey:String = "####"; //The working API key is in the zip file
var apiSecret:String = "####"; //The working API secret is in the zip file
var flickrLocationName:String;
var grabber:flickrGrabber;
function locationImage():void
{
grabber = new flickrGrabber(1024,600,apiKey,apiSecret,flickrLocationName,false);
grabber.addEventListener("imageReady", onLoadedImage);
grabber.addEventListener("flickrGrabberError", onErrorImage);
grabber.addEventListener("flickrConnectionReady", onFlickrReady);
function onFlickrReady(evt:Event):void
{
grabber.loadNextImage();
}
function onLoadedImage(evt:Event):void
{
addChildAt(grabber.image,0);
}
function onErrorImage(evt:ErrorEvent):void
{
trace("Report error: " + evt.text);
}
}
我很确定要更改我需要删除的图像
addChildAt(grabber.image,0);
并重新运行该函数
locationImage();
,但他是我最好的猜测。
I am trying to integrate flickr into a weather app (yahoo weather api) that I've created and decided to start by leveraging flickrGrabber (http://blog.organa.ca/?p=19) as a starting point. I have both the weather app and flickrGrabber working however updating flickrGrabber after initial load is proving very challenging for me.
The initial image is being pulled via a search term set by a variable called flickrLocationName and I am able to update the variable value successfully upon entry of a new zip code however I can't seem to get flickrGrabber to unload & reload with the new value. My flickrGrabber code is on layer documentAS. The flickrGrabber class can be found within the Src folder and var flickrLocationName gets set from the WeatherObject class which can also found in the Src folder.
You can see what I mean by visiting this link:
http://truimage.biz/WAS400/WeatherApp/Deploy/weatherApp.html
Of course my source can be downloaded here:
http://truimage.biz/WAS400/weatherApp.zip
Any help would be very much appreciated. Here is some sample code:
import flickrGrabber;
var apiKey:String = "####"; //The working API key is in the zip file
var apiSecret:String = "####"; //The working API secret is in the zip file
var flickrLocationName:String;
var grabber:flickrGrabber;
function locationImage():void
{
grabber = new flickrGrabber(1024,600,apiKey,apiSecret,flickrLocationName,false);
grabber.addEventListener("imageReady", onLoadedImage);
grabber.addEventListener("flickrGrabberError", onErrorImage);
grabber.addEventListener("flickrConnectionReady", onFlickrReady);
function onFlickrReady(evt:Event):void
{
grabber.loadNextImage();
}
function onLoadedImage(evt:Event):void
{
addChildAt(grabber.image,0);
}
function onErrorImage(evt:ErrorEvent):void
{
trace("Report error: " + evt.text);
}
}
I'm pretty sure to change the image I need to remove the
addChildAt(grabber.image,0);
and rerun the function
locationImage();
But his is my best guess.
发布评论