--1st Issue - populating the vbox in the right way
So here is my issue. I'm querying a third party application for 3 types of
data.  To display it into a single timeline (holder), I combined all of the
data into an ArrayCollection which i then sort by date in descending order
(last date first). (see FUNCTION A)

Once that the ArrayCollection is built (on init at least), I then run it
through a loop and add it to a VBOX with a custom renderer (See FUNCTION B).
 The custom renderer also performs some analysis of the information being
passed.

Now to complicate matters, I'm querying the two different types of messages
at different interval (because of an overall cap in http request that can be
made).  I don't have to worry about re-ordering based on the general
messages which are polled for every minute, but the direct messages are
polled every 5 minutes.  So conceivably in the timeline a sort needs to
happen.  Because of the fact that operations need to happen and i want the
user interface to be acceptable, i don't want to redraw my entire timeline
every time.

Looking for help in determining the best way to implement this process so
that

   - messages that have appeared in the past can be "inserted" into the
   correct position in the timeline (holder)
   - messages displayed in the timeline can be filtered (using
   arrayCollection mainly for this)


Love the community's feedback especially if you've encountered a similar
issue in the past.

-FUNCTION A

private function displayTimelineHandler(tmlObj:TweetCommEvent):void {

trace(">>displayTimelineHandler");

var tempTml:Array = tmlObj.data as Array;

var j:int = this._mTimeline.length;

  if (this._initFlag) {

// if the app is powering up just go ahead and add the

for (var i:int=0;i<tempTml.length;i++) {

var obj:Tweet = new Tweet();

obj._itemID = tempTml[i].id;

obj._itemTitle = tempTml[i].text;

obj._itemThumb = tempTml[i].user.profileImageUrl;

obj._itemAuthor = tempTml[i].user.screenName;

obj._timeStamp = (tempTml[i].createdAt as Date).getTime();

obj._itemType = "timeline";

this._mTimeline.addItemAt(obj, j);


 j++;


 }

}

 }

--FUNCTION B

private function displayTimeline(timelineObject:TweetCommEvent):void

{

trace(">>displayTimeline");

 //var timelineObjs:Array = timelineObject.data as Array;

var timelineObjs:ArrayCollection = new ArrayCollection(timelineObject.data
as Array);

var dateNow:Date = new Date();

var dateNowMS:Number = dateNow.getTime();

 trace(">> " + timelineObjs.length);

tweetPanel.visible = false;

 /* looping through the results here to decouple the data format from
display*/

for (var i:int=0;i<timelineObjs.length;i++) {

var newURL:String = new String();

var vbRenderer:VBoxSimpleRenderer = new VBoxSimpleRenderer();

vbRenderer._itemID = timelineObjs[i].id;

vbRenderer._itemTitle = timelineObjs[i].text;

vbRenderer.determineURL();

vbRenderer._itemThumb = timelineObjs[i].user.profileImageUrl;

vbRenderer._itemAuthor = timelineObjs[i].user.screenName;

vbRenderer.determineHowLong(timelineObjs[i].createdAt, dateNowMS);

 holder.addChild(vbRenderer)

}

trace(ObjectUtil.toString(timelineObjs));

trace(">>displayTimeline 2");

}
-- 
Sean Scott
cell: 612.867.8133
portfolio: http://www.flickr.com/photos/92876...@n00/sets/72157613990263453/
profile: http://www.linkedin.com/profile?viewProfile=&key=2242610
blog: http://www.twofortyeight.com/
other: http://twitter.com/kalisurfer

Reply via email to