Return to Snippet

Revision: 35494
at November 9, 2010 12:42 by alptugan


Initial Code
public function getMainItems():Vector.<VOItem>
{
    //Length of Main items
    MainItemLn = xml.item.length();
 
    //Vector class of MainItems
    var MainVO:Vector     = new Vector.<VOItem>(MainItemLn,true);
 
    for(var i:int = 0; i < MainItemLn; ++i)
    {
        MainVO[i]        = new VOItem();
        MainVO[i].id     = i;
        MainVO[i].title  = xml.item[i].@title;
        MainVO[i].img = xml.item[i].@img;
    }
 
    return MainVO
}

trace(getMainItems()[0].title);
//or
trace(getMainItems()[1].title);
//and so on..
.
.
.

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

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

Initial Title
Return Vector Array

Initial Tags
array, function

Initial Language
ActionScript 3