PDA

View Full Version : Flex and FlashPaper Help


JorawarSingh
09-16-2009, 05:49 PM
Hi All,

Firstly, I am new into flex 3.

There is a need in my project to show pdf file and do selection over the text. I got sollution to add flashpaper document. Flash paper compile the pdf file or any other printable document and convert it into swf.

So, here i am loading flashpaper document into my flex application. As the flex 3 is using as3 and flashpaper apis is in as2 i am using as3->as2->as2 bridge to communicate between the files.

Here is some more description.

I have a flex application where this code is written-

private function initApp():void
{
loadSwf();
}

private function loadSwf():void
{
var request:URLRequest = new URLRequest("assets/swf/sample.swf");
var loader:Loader = new Loader();
loader.load(request);

var fp = loader.content.getIFlashPaper();

//swfloader.source = loader;

var myComponent:SWFLoader = new SWFLoader();
myComponent.addChild(loader);
swfContainer.addChild(myComponent);

loader.contentLoaderInfo.addEventListener(Event.IN IT,test)


sending_lc.addEventListener(StatusEvent.STATUS, onStatus);

}


public function test(fp:*):void
{
sending_lc.send("lc_name", "methodToExecute" , "String");
}


in flashPaperDocument files which i am loading in flex load another file which is flashpaper compliled document.
The problem is this, everything loads fine, but i am not able to do selection over the text inside the flashpaper document.

Please help me or give me some directives or alternative ways to this?

wvxvw
09-17-2009, 12:45 AM
This really depends on what your text in the loaded SWF is. It may also happen that it was converted to graphics, thus you will not be able to select the text at all.
If it's a static text, then you may want to look into:
http://livedocs.adobe.com/flex/3/langref/flash/text/TextSnapshot.html
TextSnapshot class.
It seems like you're using Grant Skinner's bridge solution. Or at least it looks very similar to that. The solution using LocalConnection is OK, but, if you're sure your SWF will be working on the web (i.e. embedded in the HTML page) using ExternalInterface is preferable IMO. It will allow you to make synchronous calls from one SWF to another, making it much easier to implement.

Besides, if you may be interested, I have written a small set of classes to do the communication AS3<->AS2 too. You can check it out here:
http://e4xu.googlecode.com/files/avm1bridge.zip
(SWC + documentation)
http://code.google.com/p/e4xu/source/browse/#svn/trunk/src/as2/src/org/wvxvws/lcbridge
(AS2 sources)
http://code.google.com/p/e4xu/source/browse/#svn/trunk/src/org/wvxvws/lcbridge
(AS3 sources)

I'm working on this project still, and, it doesn't have an option for using ExternalInterface thus far, but I'll be adding that soon.

JorawarSingh
09-18-2009, 11:54 AM
Thank you sir, for your reply.

You understanding is correct.

Thanks for the classes. I have downloded these files and trying to convert it into as per my need. However, I would request you to send me an example as I'm near to miss my deadlines.

Problem Description:

I'm uploading word document (having only text in it) in FlashPaper, that converts it into document.swf(AS2), this document is being uploaded in flash file(AS2) and then flash object is called inside flex (AS3) object.

You any help will be appreciated.

Thanks in Advance

wvxvw
09-18-2009, 02:58 PM
I don't have a converter that you're using... can you post a SWF converted from DOC? I would see if I can select text there...