Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // script for main
- import rss.RssItem;
- import rss.DB;
- // use a loop to create MenuItem instances and load each with info from the DB
- for (var i: Number = 0; i < 8; i++) {
- // make a new item from menuItem Symbol in Library
- var mItem: MovieClip = new MenuItem();
- mItem.name = String(i); // name is it's itemID
- mItem.addEventListener(MouseEvent.CLICK, clickListener);
- mItem.x = 20;
- mItem.y = 20 + (i * 50);
- mItem.title_txt.text = RssItem(db.getItem(i)).title;
- this.addChild(mItem);
- }
- stop();
- // called when any menuItem is clicked
- function clickListener(ev: MouseEvent) {
- // get the itemID number from the name of the thing that was clicked
- var itemID: Number = ev.target.parent.name * 1;
- // set up main info display
- var myItem: RssItem = db.getItem(itemID);
- this.title_txt.text = myItem.title;
- this.date_txt.text = myItem.pubDate;
- // assemble the link to the full story
- this.link_txt.htmlText = '<a href="' + myItem.link + '">See Full Story</a>';
- // Note that some sites send html in the description!
- this.comment_txt.htmlText = myItem.description;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement