Posted By

alptugan on 11/09/10


Tagged

type array function return Vector


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

sexyflash
tspitzr


Return Vector Array


 / Published in: ActionScript 3
 

URL: http://blog.alptugan.com/?p=380

1067: Implicit coercion of a value of type AS3.vec:Vector.<com.Gallery:VOItem> to an unrelated type AS3.vec:Vector.

  1. public function getMainItems():Vector.<VOItem>
  2. {
  3. //Length of Main items
  4. MainItemLn = xml.item.length();
  5.  
  6. //Vector class of MainItems
  7. var MainVO:Vector = new Vector.<VOItem>(MainItemLn,true);
  8.  
  9. for(var i:int = 0; i < MainItemLn; ++i)
  10. {
  11. MainVO[i] = new VOItem();
  12. MainVO[i].id = i;
  13. MainVO[i].title = xml.item[i].@title;
  14. MainVO[i].img = xml.item[i].@img;
  15. }
  16.  
  17. return MainVO
  18. }
  19.  
  20. trace(getMainItems()[0].title);
  21. //or
  22. trace(getMainItems()[1].title);
  23. //and so on..
  24. .
  25. .
  26. .

Report this snippet  

You need to login to post a comment.