Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // script for main
  2. import rss.RssItem;
  3. import rss.DB;
  4. // use a loop to create MenuItem instances and load each with info from the DB
  5. for (var i: Number = 0; i < 8; i++) {
  6. // make a new item from menuItem Symbol in Library
  7. var mItem: MovieClip = new MenuItem();
  8. mItem.name = String(i); // name is it's itemID
  9. mItem.addEventListener(MouseEvent.CLICK, clickListener);
  10. mItem.x = 20;
  11. mItem.y = 20 + (i * 50);
  12. mItem.title_txt.text = RssItem(db.getItem(i)).title;
  13. this.addChild(mItem);
  14. }
  15. stop();
  16. // called when any menuItem is clicked
  17. function clickListener(ev: MouseEvent) {
  18. // get the itemID number from the name of the thing that was clicked
  19. var itemID: Number = ev.target.parent.name * 1;
  20. // set up main info display
  21. var myItem: RssItem = db.getItem(itemID);
  22. this.title_txt.text = myItem.title;
  23. this.date_txt.text = myItem.pubDate;
  24. // assemble the link to the full story
  25. this.link_txt.htmlText = '<a href="' + myItem.link + '">See Full Story</a>';
  26. // Note that some sites send html in the description!
  27. this.comment_txt.htmlText = myItem.description;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement