Home > Default > How can I open an attachment from inside a PDF portfolio using flex 4.1?

How can I open an attachment from inside a PDF portfolio using flex 4.1?

October 11Hits:2
I am currently developing a portfolio and have a DataGrid which lists my sorted attachments.
I can right click on an attachment to open it but I require it to happen on the double click event.
My code currently looks like this (taken from an old example):
private function itemDoubleClicked(event:ListEvent):void
                                        var itemIndex:int = event.rowIndex;
                                        var item:AttachmentImpl = AttachmentImpl(sortedCurrentItems.getItemAt(itemIndex));
                                        var command:CommandImpl = collectionManager.host.commands(acrobat.collection.CommandType.PREVIEW);
                                        Alert.show("you double clicked " + item.fileName);
                                        collectionManager.host.selection = [item];
but i get a null pointer exception because command is null.
Could anyone give me pointers or another solution?
I would like to extend this question as follows:
when using 'host.commands' (as i believe is correct) I get the error that host is 'write-only' and therefore can access none of its methods.
The example I use is from here: http://pdfdevjunkie.host.adobe.com/05_sorting.shtml
Using this method, the host is overwritten by doing the following:
public function set host(host:INavigatorHost):void
                                             if(host != null) {
                                                       _host = host;
                                             } else {
                                                       _host = null;
                                                       //Alert.show("Navigator Ending");
When I try to do this I recieve the error that the method is not set for override.


If i try to simply use the host e.g.
host.selection = [item];
It tells me that host is write-only. How can this be true?

Read other 2 answers


Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.762 s.