{"id":24,"date":"2008-07-14T22:33:22","date_gmt":"2008-07-15T05:33:22","guid":{"rendered":"http:\/\/www.nayansavla.com\/blog\/?p=24"},"modified":"2008-07-14T22:33:22","modified_gmt":"2008-07-15T05:33:22","slug":"cairngorm-and-remote-object","status":"publish","type":"post","link":"https:\/\/www.nayansavla.com\/blog\/?p=24","title":{"rendered":"Cairngorm and Remote Object"},"content":{"rendered":"<p>I have had opportunity to use Cairngorm with Webservices, Httpservice and Remote Object as well. I had some difficulty passing variables to the amfphp backend but ultimately resolved it. here is how,<\/p>\n<div class=\"codecolorer-container actionscript default\" style=\"overflow:auto;white-space:nowrap;width:435px;\"><div class=\"actionscript codecolorer\"><span class=\"kw3\">public<\/span> <span class=\"kw2\">function<\/span> execute<span class=\"br0\">&#40;<\/span>event:CairngormEvent<span class=\"br0\">&#41;<\/span>:<span class=\"kw3\">void<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; product = event.<span class=\"kw3\">data<\/span>.<span class=\"me1\">product<\/span>;<br \/>\n&nbsp; &nbsp; responderObj = event.<span class=\"kw3\">data<\/span>.<span class=\"me1\">responderObj<\/span>;<br \/>\n&nbsp; &nbsp; productId = product.<span class=\"me1\">products_id<\/span>;<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">var<\/span> service:RemoteObject = ServiceLocator.<span class=\"me1\">getInstance<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">getRemoteObject<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;getProducts&quot;<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span class=\"kw2\">var<\/span> operation:Operation = service.<span class=\"me1\">getOperation<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;get_colors&quot;<\/span><span class=\"br0\">&#41;<\/span> as Operation;&nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/this method of sending arguments wasn't working, it was sending undefined.&nbsp; &nbsp; &nbsp; &nbsp; <\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/var dataArray:Array = new Array({productId:&quot;93&quot;});<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/operation.argumentNames = dataArray;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span class=\"kw2\">var<\/span> token:AsyncToken = operation.<span class=\"kw3\">send<\/span><span class=\"br0\">&#40;<\/span>productId<span class=\"br0\">&#41;<\/span>;<br \/>\n&nbsp; &nbsp; token.<span class=\"me1\">addResponder<\/span><span class=\"br0\">&#40;<\/span><span class=\"kw3\">this<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p>For some reason operation.argumentNames i thought would take the array and then send the objects in this array as variables, but it was sending undefined as the value for the variable. <\/p>\n<p>I resolved the problem by sending the variables in send function and i am sure you can send more than one variable in the send function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have had opportunity to use Cairngorm with Webservices, Httpservice and Remote Object as well. I had some difficulty passing variables to the amfphp backend but ultimately resolved it. here is how, public function execute&#40;event:CairngormEvent&#41;:void &#123; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; product = event.data.product; &nbsp; &nbsp; responderObj = event.data.responderObj; &nbsp; &nbsp; productId [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[31,21,66,30],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-as-30","category-flex","tag-amfphp","tag-cairngorm","tag-flex","tag-remote-object"],"_links":{"self":[{"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24"}],"version-history":[{"count":0,"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nayansavla.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}