6 Replies Latest reply on Feb 22, 2010 12:05 AM by archemedia

    Developing Forms in Flex

    Niall O'Donovan Level 7

      Hi,

       

      I have been developing forms in LiveCycle Designer and have started to look at doing some of these in Flex. The aim is to have some hosted on a web site or grouped in an AIR application.

       

      I am working through online resources and tutorials (Tour de Flex, First steps in Flex, Adobe DevNet), which are helping a lot but we are still struggling.

       

      I would be grateful if someone could point me in the direction of a good resource specifically for forms. I am trying to capture some best practice at the start rather than discovering it at the end.

       

      Also I am having trouble printing and getting to grips with the differences from dealing with page sizes (LC Designer) to pixel dimensions (Flex). Again if anyone could point me in the direction of printing solutions for forms, it would be great. 

       

      Thanks,

       

      Niall

        • 2. Re: Developing Forms in Flex
          Niall O'Donovan Level 7

          Thanks Dany,

           

          This is great. I had seen the alivePDF in Tour de Flex, but was unsure how to implement it. The examples on Dev Girl's blog really help. I am going to do some trials with alivePDF and purePDF and see how I get on.

           

          It looks like XPAAJ isn't supported by Adobe any more. I managed to find a copy of the jar file on http://www.flexlive.net. In any case this solution may not work due to license restrictions.

           

          Thanks for your help I really appreciate it. I have my homework now ;-)

           

          Niall

          • 3. Re: Developing Forms in Flex
            archemedia Level 4

            Hi Niall,

             

            I'm looking forward to your findings in comparing purePDF with alivePDF as I'm going to develop some complex print functionality in Flex in the near future...

             

            Dany

            • 4. Re: Developing Forms in Flex
              Niall O'Donovan Level 7

              Hi Dany,

               

              Story so far...

               

              It has taken quite a bit to get alivePDF up and running. I am coming from a low level of understanding of mxml and as.

               

              I am still having difficulty getting images loaded into the PDF. Sample is here.

               

              Generally alivePDF is good, once you get into the swing. But it is driven line by line:

               

              myPDF.addText("Organisation: " + this.orgName.text, 20, 40); 

               

              It can be clunky, if you move something high up on the page, you have to amend the position of all of the objects below it. This leads to duplication of effort: (1) declaring objects in Flex for display; and (2) declaring objects for adding to PDF.

               

              It can be trial and error. In Flex I had a multi-line object, which if I used addText it would look like "line1\rline2\rline3" in the PDF.

               

              myPDF.addText("Trading address: " + this.tradeAddress.text, 20, 50);

               

              Switching addText to addMultiCell needed three lines of as:

               

              myPDF.addText("Trading address: ", 20, 50); 
              myPDF.setXY(55, 46.75);
              myPDF.addMultiCell(120, 4, this.tradeAddress.text);
              

               

              It resolved the multi-line input, but it involved trial and error in getting the x, y coordinates to work. I suspect that this is to be expected.

               

              I have not had time to try out purePDF as yet, but I suspect that it is a similar process. One aspect is that (as far as I can tell) alivePDF will work with flash < 10, but purePDF needs flash 10. Could be wrong.

               

              It is surprising that given Adobe's history in print and PDF, that there is this (apparent) gap between Flex/Flash and PDF.

               

              Thanks,

               

              Niall 

              • 5. Re: Developing Forms in Flex
                archemedia Level 4

                Hi Niall,

                 

                It's indeed a ******

                Flash and Flex technology doesn't come from Adobe but from Macromedia. Flash was always intended for the screen.

                I never understood why Adobe didn't focus on implementing postscript print functionality in Flash player once they acquired it.

                So, indeed, you will have to write a class for every form you wish to generate.

                As for coördinates, especially y-axis, I'd use a incremental value so that, if you remove a line, all the rest will re-flow.

                 

                Thanks for the feedback

                 

                Dany

                1 person found this helpful
                • 6. Re: Developing Forms in Flex
                  Niall O'Donovan Level 7

                  Thanks Dany,

                   

                  I will try and implement the incremental positioning - it would be easier in the long run.

                   

                  Niall