[Flashr] Facing problem while loading Photo Data with pages and cacheQueries
Swami Charan
swamicharan at gmail.com
Mon Dec 7 05:39:47 PST 2009
Hi,
When i try to traverse through the Pages of *photosSearch* by incrementing
and decrementing the PAGE_NUMBER on clicking, for say, NEXT and PREVIOUS
buttons based on search by a tag, i am able to traverse through the pages
without any issue.
But the problem comes when i try to goto PAGE 1 from PAGE 2 with
'*_flashr.cacheQueries
= true;*'. In this case, my code for fetching the Photo data is not able to
get the photo information. DEBUG output says following lines:
*DEBUG*:"queueRequest - dispatching cached response for
[com.kelvinluck.flashr.core.FlashrRequest - 147 {flickr.photos.getInfo}]"
Loaded detailed data for photo '4166171796'
*DEBUG*:"[com.kelvinluck.flashr.core.FlashrRequest - 148
{flickr.photos.getInfo}] generated"
*DEBUG*:"queueRequest - dispatching cached response for
[com.kelvinluck.flashr.core.FlashrRequest - 148 {flickr.photos.getInfo}]"
Loaded detailed data for photo '4166157798'
*DEBUG*:"[com.kelvinluck.flashr.core.FlashrRequest - 149
{flickr.photos.getInfo}] generated"
The Code which i am using to store the Photos Data is as follows (from the
example provided on the website):
function startSearch(tags:String) {
_photos = [];
_flashr.photosSearch({tags:tags, per_page:NUM_RESULTS, page:PAGE_NUMBER});
}
function onPhotosSearch(rs:ResultsSet) {
_numResults = rs.photos.length;
for (var i:Number = 0; i<_numResults; i++) {
var thisPhoto:Photo = rs.photos[i];
_flashr.photosGetInfo(thisPhoto.id,thisPhoto.secret);
}
}
function onPhotosGetInfo(photo:Photo) {
log("Loaded detailed data for photo '"+photo.id+"'");
_photos.push(photo);
if (_photos.length == _numResults) {
onAllPhotosLoaded();
}
}
function onAllPhotosLoaded() {
log("*************ALL PHOTO INFO LOADED*************");
log(" ");
imageData = new Array();
for (var i:Number = 0; i<_photos.length; i++) {
var thisPhoto:Photo = _photos[i];
var myObj:Object = new Object();
myObj.id = thisPhoto.id;
myObj.title = thisPhoto.title;
myObj.taken = thisPhoto.dateTaken;
myObj.thumbnail = thisPhoto.thumbnailUrl;
myObj.mediumURL = thisPhoto.mediumUrl;
myObj.photoURL = thisPhoto.photoPageUrl;
imageData.push(myObj);
}
trace("IMAGE DATA LENGTH"+imageData.length);
loadImages();
}
function loadImages() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
_root.container_mc._x = 200;
_root.container_mc._y = 200;
// MovieClipLoader to load thumbnail image
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._width = 75;
target_mc._height = 75;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
for (var i = 0; i<imageData.length; i++) {
var temp_mc = _root.container_mc.attachMovie("thumbHolder_mc", "thumb"+i,
_root.container_mc.getNextHighestDepth());
temp_mc._x = 8+(temp_mc._width)*(i%10); //X Position
temp_mc._y = Math.floor(i/10)*(temp_mc._height+5); //Y Position
image_mcl.loadClip(imageData[i].thumbnail,temp_mc.thumb_mc); //Loading
Thumbnail Image into Movieclip
}
}
_root.next_btn.onRelease = function() { // Clicking this should showup Next
page of PhotosSearch
var myLeftTween:Tween = new Tween(container_mc, "_x", Strong.easeInOut,
200, -900, 1, true);
_root.removeMovieClip(_root.container_mc);
PAGE_NUMBER+=1;
startSearch(searchTag);
};
_root.previous_btn.onRelease = function() { // Clicking this should showup
Previous page of PhotosSearch
var myRightTween:Tween = new Tween(container_mc, "_x", Strong.easeInOut,
200, 1350, 1, true);
_root.removeMovieClip(_root.container_mc);
PAGE_NUMBER-=1;
startSearch(searchTag);
};
When i make '*_flashr.cacheQueries = false;*', it works fine by loading all
the images properly, but this would not be good design to load the already
once loaded images again from Flickr Server.
How to deal with this with '*_flashr.cacheQueries = true;*'???
Can somebody help me out with this?
Thanks
Swami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/flashr_osflash.org/attachments/20091207/19c1e25a/attachment.html>
More information about the Flashr
mailing list