开发者

Updating a flickr image upon user input

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():vo开发者_开发知识库id
{
    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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜