Many thanks Dasa and Robert...I finally fixed it...Robert is it possible to run this OnComplete function from the menu?I wish I could launch PDF by the menu...based on "Building1.selectedItem.@dgn"Cheers,Naty
Dasa, Thanks for the tip.Naty, Based on Dasa's advice this works: public function IOErrorEventHandler(imgx:String):void { var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.addEventListener(ProgressEvent.PROGRESS, onComplete); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { var nameBuilding:String = Building1.selectedItem.@dgn; nameBuilding="CleanPrintA4/" + nameBuilding.toString().substr(0,nameBuilding.leng th-4) + ".pdf"; var u:URLRequest = new URLRequest(nameBuilding); navigateToURL(u, "_blank"); } private function ioErrorHandler(event:IOErrorEvent):void { trace(event.toString()); }
public function IOErrorEventHandler(imgx:String):void { var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.addEventListener(ProgressEvent.PROGRESS, onComplete); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { var nameBuilding:String = Building1.selectedItem.@dgn; nameBuilding="CleanPrintA4/" + nameBuilding.toString().substr(0,nameBuilding.leng th-4) + ".pdf"; var u:URLRequest = new URLRequest(nameBuilding); navigateToURL(u, "_blank"); } private function ioErrorHandler(event:IOErrorEvent):void { trace(event.toString()); }
Naty, What is the string that you are passing in for the imgx? Is it the same as the nameBuilding?public function IOErrorEventHandler(imgx:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete); loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, ioErrorHandler); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { var nameBuilding:String = Building1.selectedItem.@dgn; nameBuilding="CleanPrintA4/" + nameBuilding.toString().substr(0,nameBuilding.leng th-4) + ".pdf"; var u:URLRequest = new URLRequest(nameBuilding); navigateToURL(u, "_blank"); } private function ioErrorHandler(event:IOErrorEvent):void { }
public function IOErrorEventHandler(imgx:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete); loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, ioErrorHandler); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { var nameBuilding:String = Building1.selectedItem.@dgn; nameBuilding="CleanPrintA4/" + nameBuilding.toString().substr(0,nameBuilding.leng th-4) + ".pdf"; var u:URLRequest = new URLRequest(nameBuilding); navigateToURL(u, "_blank"); } private function ioErrorHandler(event:IOErrorEvent):void { }
Sorry it was just a sample...I corrected it...Thanks.Naty
Naty, With the code you just posted you are attempting to load a PDF file into an image control which is not supported. There is no PDF viewer component in Flex by default.
Naty, What doesn't work? What are you trying to do? What does your code changes look like when you try to make this work for pdfs? This was a while ago that I help you with this and I am not even sure what you were doing here...
Hi Robert!!Thanks, I tried with the following code:Now I want to ask u how can I set a value to the MiniSearch widget textbox from the SearchWidget..Can u help me with this? public function IOErrorEventHandler(imgx:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { infoImage.source = "Images/" + infoData.title + ".jpg"; infoImage.height = 150; infoImage.width = 190; infoImage.visible = true; infoImage.includeInLayout = true; } private function ioErrorHandler(event:IOErrorEvent):void { infoImage.visible = false; infoImage.includeInLayout = false; }
public function IOErrorEventHandler(imgx:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); var request:URLRequest = new URLRequest(imgx); loader.load(request); } private function onComplete (evt : Event) : void { infoImage.source = "Images/" + infoData.title + ".jpg"; infoImage.height = 150; infoImage.width = 190; infoImage.visible = true; infoImage.includeInLayout = true; } private function ioErrorHandler(event:IOErrorEvent):void { infoImage.visible = false; infoImage.includeInLayout = false; }
Naty, Took me a little while to find the time but here is the solution. this.parentApplication.miniSearch.Building.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn").parent(); this.parentApplication.miniSearch.Plan.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn");
this.parentApplication.miniSearch.Building.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn").parent(); this.parentApplication.miniSearch.Plan.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn");
Naty, Hmm... Explain to me the desired work flow?Right now even your xml is malformed... Should look like this <?xml version="1.0" encoding="utf-8"?> <Buildings> <Building name='1'> <Plan code='P1' dgn='1p1.dgn'/> <Plan code='PT' dgn='1pt.dgn'/> <Plan code='S1' dgn='1s1.dgn'/> </Building> <Building name='11O'> <Plan code='PT' dgn='11opt.dgn'/> <Plan code='S1' dgn='11os1.dgn'/> </Building> </Buildings> NOT <Plan code='S1' dgn='11os1.dgn'/Plan>
Should look like this <?xml version="1.0" encoding="utf-8"?> <Buildings> <Building name='1'> <Plan code='P1' dgn='1p1.dgn'/> <Plan code='PT' dgn='1pt.dgn'/> <Plan code='S1' dgn='1s1.dgn'/> </Building> <Building name='11O'> <Plan code='PT' dgn='11opt.dgn'/> <Plan code='S1' dgn='11os1.dgn'/> </Building> </Buildings> NOT <Plan code='S1' dgn='11os1.dgn'/Plan>
I sent u the Minisearch and the XML source 🙂 I wish I could select building and plan passing @dgn value...Thank u soooooo much,Naty
Naty, Sure it's possible can you post your MiniSearch.mxml?
Naty, Add an id to the minisearch like so:<widgets:MiniSearch id="miniSearch" top ="120" left="50"/> then you need to do call this from where everthis.parentApplication.miniSearch.ti.text = "hello";
<widgets:MiniSearch id="miniSearch" top ="120" left="50"/>
this.parentApplication.miniSearch.ti.text = "hello";
Naty, OK I need just a little bit more. Remind me you put the MiniSearch in your Index.mxml right? Does the MiniSearch have an id attribute and if so what is it? Basically we will have to get a reference to the MiniSearch throught the SearchWidget using parrentApplication and then using the id of the minisearch and the id of the textInput.
Natty, Can you be a little more specific? Are you wanting to send the image that you got to the MiniSearch or just a string value? I need to have a clear idea of your desired work flow.
Natty, Try something like this:loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, imgLoadErrorMethod);
loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, imgLoadErrorMethod);
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.