1

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.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • Try to isolate the problem and build a minimal example so you can post the code with your question. – Matthias Jun 07 '11 at 18:29
  • looks like it works to me. I enter 1 zip press go and it works. I delete the first zip by pressing the X 5 times then type a new zip and press go and that works. So whats the problem? – The_asMan Jun 07 '11 at 18:59
  • @The_asMan, the weather does work fine but you'll see the background (the ocean scene) doesn't change when I recall the function and pass the new variable value. – Dave Bergschneider Jun 07 '11 at 19:34
  • @Matthias, I have uploaded a new version of the zip file that simplifies the code and added the code I'm actively working with on the timeline. The rest of the code is embedded within classes. – Dave Bergschneider Jun 08 '11 at 00:33

0 Answers0