Null errors within print2flash_fla

Publishing Flash documents by embedding them in Flex applications
Post Reply
kevindwise
Posts: 4
Joined: Sun Aug 25, 2013 10:04 am

Null errors within print2flash_fla

Post by kevindwise » Sun Aug 25, 2013 10:33 am

Hi,

I am trying to embed a swf created with print2flash in to an AIR application; ultimately I need it for both desktop and mobile.

I have installed the trial of print2flash and generated swf files, with output settings using the Standard Actionscript 3 template, and with all the 'disable' settings unchecked.

I have tried to load the generated swf using the Print2FlashDoc3 MXML component from the print2flash SDK download.

I have also tried downloading using a Loader directly, setting the LoaderContext domain as detailed at http://help.adobe.com/en_US/FlashPlatfo ... oader.html

I have tried doing this within a desktop app, and within a mobile app.

In all cases, the swf fails to display. When I use the Loader, I get the following error message when the swf completes loading:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at print2flash_fla::MainTimeline/CenterMsg()
at print2flash_fla::MainTimeline/frame1ResizeHandler()
at print2flash_fla::MainTimeline/OnSettingsAvailable()
at print2flash_fla::MainTimeline/frame1()

For a mobile project, using Print2FlashDoc3.mxml, I find that Security.allowDomain("*") throws an exception, and then when loading completes I get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at print2flash_fla::MainTimeline/frame2()

I have attached a .zip containing my 3 test projects (which are set up to use Flex SDK 4.5.1, but I have tried withi 4.6 too).

Can anyone advise how to get a print2flash swf to load in an AIR app?

I like the look of the API and I would buy the product if it works, but at the moment it looks like it is a non starter :-( - hopefully I am just missing a trick.

Thanks,

Kevin

staff
Posts: 281
Joined: Sat Dec 15, 2007 4:48 pm

Re: Null errors within print2flash_fla

Post by staff » Mon Aug 26, 2013 4:15 am

There are no ZIP files attached to your post. Please repost it here or send it to our support e-mail.

kevindwise
Posts: 4
Joined: Sun Aug 25, 2013 10:04 am

Re: Null errors within print2flash_fla

Post by kevindwise » Mon Aug 26, 2013 4:14 pm

Ah, the upload attachment mechanism seems to be rejecting my files, I'll send to support @ print2flash.com.

staff
Posts: 281
Joined: Sat Dec 15, 2007 4:48 pm

Re: Null errors within print2flash_fla

Post by staff » Tue Aug 27, 2013 7:25 am

We received your project files, checked your project and found out that the Print2Flash document you are trying to load was generated with Print2Flash Document API disabled. You should enable this API in order to be able to load Print2Flash documents. To enable API, you need to clear Disable Print2Flash Document API Support checkbox in the Protection Tab of Document Options window.

You should use Print2FlashDoc3 Flex component in order to load Print2Flash documents in your application. You cannot use Loader class for this. We recommend you to take a Flex sample from Print2Flash SDK (the sample is located in the “DocumentAPI\ActionScript3 documents\Samples\Flex" folder of SDK archive).

kevindwise
Posts: 4
Joined: Sun Aug 25, 2013 10:04 am

Re: Null errors within print2flash_fla

Post by kevindwise » Tue Aug 27, 2013 8:37 am

Thanks for the pointer to the Flex example, which I'd somehow missed.

I always had the ' Disable Print2Flash Document API support' checkbox cleared, so it wasn't that - but I was able to load my document in the Flex sample, including when I converted it to AIR, so by incrementally taking parts from the sample I'm now able to move forward. Once I understand exactly why it wasn't working I'll post details here.

kevindwise
Posts: 4
Joined: Sun Aug 25, 2013 10:04 am

Re: Null errors within print2flash_fla

Post by kevindwise » Tue Aug 27, 2013 9:29 am

I am finding that I can get an AIR desktop app to load a print2flash swf, if I manually place the swf in the bin instead of using Embed.

However, I get an error when I load the print2flash swf in a mobile project.

In my simple mobile project, I have:
- Created a new Flex Mobile project
- Copied the code and images from the Print2Flash AS 3 Flex sample
- Copied the sample.swf from the flex sample in to bin-debug
- Added mx.swc from the Flex SDK (4.5.1) to the project build path and made changes to the mx namespaces in Print2FlashDoc3.mxml to get the app to compile

When I run the app in the desktop Mobile simulator, simulating iOS, I get the following when the .swf is loaded:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at print2flash_fla::MainTimeline/frame2()

Could this be due to the restriction on iOS loading swfs with actionscript? It is for that reason I wanted to use the Loader class (http://help.adobe.com/en_US/FlashPlatfo ... oader.html) explicitly, so I could set the LoaderContext to use ApplicationDomain.currentDomain.

Can you advise if print2flash can be made to work for an AIR mobile project, and if so, what I am missing? It was issues accessing .pdf files on mobile that Iead me to want to use Print2Flash.

I will email the project .zip to support: when I try to attach it to this mail I keep getting "Could not upload attachment to ./files/7779_97f60f4fc75f9d86fb8ff3a143ba37d9", even though the .zip is now only 118KB.

Thanks,

Kevin

staff
Posts: 281
Joined: Sat Dec 15, 2007 4:48 pm

Re: Null errors within print2flash_fla

Post by staff » Wed Aug 28, 2013 10:11 am

We checked this issue and found a problem with our standard ActionScript 3 document template. We corrected it and are sending you a fixed custom document template (see it attached). To apply this template, you need to:

1. Copy the attached template file to disk and unpack it from the archive
2. Launch Print2Flash Application by choosing “All Programs/Print2Flash/Print2Flash Printing Application” from the Windows start menu
3. Choose Options/Default Document Options from the application menu
4. Switch to Output tab
5. Choose Custom Template option and pick the template file from disk

Then you need to reconvert your document with Print2Flash and try to use the new document instead of the old one.
Attachments
print2flash.interface3.pro.zip
(93.67 KiB) Downloaded 547 times

Post Reply