topical media & game development

talk show tell print

sample-PhotoService.ax

sample-PhotoService.ax (swf ) [ flash ]


  

/////////////////////////////////////////////////////////////////////////


// // Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors. // All Rights Reserved. // The following is Sample Code and is subject to all restrictions on such code // as contained in the End User License Agreement accompanying this product. // If you have received this file from a source other than Adobe, // then your use, modification, or distribution of it requires // the prior written permission of Adobe. //

/////////////////////////////////////////////////////////////////////////


package { import flash.events.*; import mx.collections.ArrayCollection; import mx.collections.IViewCursor; import mx.core.Application; import mx.rpc.events.ResultEvent; import mx.rpc.http.HTTPService; import mx.utils.ArrayUtil; public class sample-PhotoService { private var service:HTTPService; [Bindable] public var galleries:ArrayCollection; public function sample-PhotoService(url:String) { service = new HTTPService(); service.url = url; service.addEventListener(ResultEvent.RESULT, resultHandler); service.send(); } private function resultHandler(event:ResultEvent):void { var result:ArrayCollection = event.result.galleries.gallery is ArrayCollection ? event.result.galleries.gallery as ArrayCollection : new ArrayCollection(ArrayUtil.toArray(event.result.galleries.gallery)); var temp:ArrayCollection = new ArrayCollection(); var cursor:IViewCursor = result.createCursor(); while (!cursor.afterLast) { temp.addItem(new sample_Gallery(cursor.current)); cursor.moveNext(); } galleries = temp; } } }


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.