Select to view content in your preferred language

Featurelayer.addAttachment problem in flex

880
2
01-19-2011 01:58 AM
ReenaSingh
Emerging Contributor
Hi,

I am facing problem while using
var objectid:Number = serviceRequestId ;
var contentType:String ="jpeg";
var nameAttachment:String ="Service request attachment";
feature_ServiceRequest_Layer.addAttachment(objectid,_model.uploadedFileContent,_model.uploadedFileName,null,new AsyncResponder(onAttchmentResult,onFault));

I get the given error:
SecurityError: Error #2176: Certain actions, such as those that display a pop-up window, may only be invoked upon user interaction, for example by a mouse click or button press.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at com.esri.ags.utils::MultipartURLLoader/doSend()
at com.esri.ags.utils::MultipartURLLoader/load()
at com.esri.ags.tasks::FeatureServiceTask/addAttachment()
at com.esri.ags.layers::FeatureLayer/addAttachment()
at com.esri.solutions.csp.views::MainMap/attchImagesToServicerequest()
at com.esri.solutions.csp.views::MainMap/onAddComplete_feature_ServiceRequest_Layer()
at mx.rpc::AsyncResponder/result()
at com.esri.ags.tasks::FeatureServiceTask/handleApplyEdits()
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/handleResult()
at Function/<anonymous>()
at mx.rpc::Responder/result()
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()
at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


Please suggest me the solution.
Tags (2)
0 Kudos
2 Replies
DasaPaddock
Esri Regular Contributor
Because of this Flash Player security restriction, you have to call featureLayer.addAttachment() after a button click. For example, if you have a button letting them choose a file using a FileReference, you need to have another button click before you call addAttachment(). You can't call it directly in the fileReference's complete event handler.
0 Kudos
ReenaSingh
Emerging Contributor
Because of this Flash Player security restriction, you have to call featureLayer.addAttachment() after a button click. For example, if you have a button letting them choose a file using a FileReference, you need to have another button click before you call addAttachment(). You can't call it directly in the fileReference's complete event handler.




Thank you very much, it worked 🙂
0 Kudos