Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10
Accepted Solution

Payment Services in Flash Professional CS6?

[ Edited ]

I am trying to test the PaymentServiceDemo.with Flash Professional CS6 as provided in the BlackBerry documentation . The first error I get is the "com.test.paymentapi" after package in the .as files throws an error message. Removing it solves that problem. I've added "framework.swc", "rpc.swc", "rpc_rc.swc", "QNXDevice.ane", "QNXNetwork.ane", "QNXSensors.ane" and "QNXSkins.ane" to the Library path. When I run the Flash project I get an error that the "SuccessEvent" is not recognized. I then added the "Blackberry.swc" from the /libs/blackberry folder to remove that error. Then I get a long list of "Label" not recognized, etc. from the qnx library. I add the "qnxui.swc" to the LIbrary and get the error that Java Virtual Machine has run out of memory. The project opens with a blank white window.

 

Has anyone implemented the Payment Service with Flash CS6? Please help.

 

And why is all the documentation for Flash Builder? It's like Flash Professional CS6 doesn't even exist around here.

Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

To be more specific, the Flash window acts as if the application has become "unresponsive" like an infinite loop has been initiated and the Jave Virtual Machine error finally pops up. The Flash project then opens in a blank white window.

Please use plain text.
BlackBerry Development Advisor (Retired)
dmalik
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook

Re: Payment Services in Flash Professional CS6?


bkirvin wrote:

 

And why is all the documentation for Flash Builder? It's like Flash Professional CS6 doesn't even exist around here.


I wrote a guide on Flash Professional here - http://supportforums.blackberry.com/t5/Adobe-AIR-Development/How-to-Create-a-BlackBerry-10-AIR-Appli...

 


bkirvin wrote:

 I've added "framework.swc", "rpc.swc", "rpc_rc.swc", "QNXDevice.ane", "QNXNetwork.ane", "QNXSensors.ane" and "QNXSkins.ane" to the Library path. When I run the Flash project I get an error that the "SuccessEvent" is not recognized. 


Make sure to set the proper link types. After compiling in Flash Professional it's very likely that it won't work on the desktop. I haven't done this but you may be able to write in a check to see what platform the swf is running on to get around this. 

 

 

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/
Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

Thank you. That's a bit different list of .swc files than BlackBerry provided, but I'm still getting "The Java Virtual Machine used for Action Script 3.0 compilation ran out of memory." error. I'm being prompted to change the memory settings in the jvm.ini file from -Xmx128m to something else. But whenever I do that, I get the message that Flash Professional has encountered an error and may need to be reinstalled.

Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

OK, I tried this. In Flash Professional in the Library tab of Action Script Settings I added:

 

textlayout.swc

QNXSkins.ane

QNXDevice.ane

blackberry.swc

qnxmedia.swc

qnx-air.swc

framework.swc

rpc.swc

rpc_rb.swc

 

When I compile I get the message that "List", "Label", "LabelButton", etc. are not recognized. When the

 

qnxui.swc

 

file is added to the LIbrary so the compiler can recognize these elements, the "Java Virtual Machine used for ActionScript 3.0 compilation has run out of memory." error appears after the SWF export hangs about half way completed.

 

I guess I'm going to create my own UI and forget the BlackBerry QNX UI. I can get the PaymentService events to work I just won't be able to use the QNX UI elements for the labels and buttons.

Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

[ Edited ]

Still not working.

 

I added the following to the Library path in ActionScript settings:

 

textlayout.swc

PFFlib.swc

framework.swc

rpc.swc

rpc_rb.swc

blackberry.swc

qnx-air.swc

qnxmedia.swc

QNXDevice.ane

 

 

I imported the following in my project class:

 

import net.rim.blackberry.events.PaymentErrorEvent;
import net.rim.blackberry.events.PaymentSuccessEvent;
import net.rim.blackberry.payment.PaymentSystem;
import net.rim.blackberry.payment.Purchase;

 

and declared the variable in the class extension:

 

private var paymentSystem:*PaymentSystem; (*added to stop emoticon display)

 

in my constructor function I added the following lines:

 

paymentSystem = new PaymentSystem();
paymentSystem.setConnectionMode(PaymentSystem.CONNECTION_MODE_LOCAL);

 

I then added the event listeners:

 

paymentSystem.addEventListener(PaymentSuccessEvent.PURCHASE_SUCCESS, purchaseSuccessHandler);
paymentSystem.addEventListener(PaymentErrorEvent.PURCHASE_ERROR, purchaseErrorHandler);

 

But.........now when I attempt to export the SWF file I get the error:

 

VerifyError: Error #1079: Native methods are not allowed in loaded code.

 

I went ahead and packaged the resulting SWF with the blackberry-airpackager and loaded it on ny Z10, but the app would not run past the splash screen.

Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

Found the fix to the Java Virtual Machine memory error. After browsing the Adobe Forum I found that the jvm.ini file has limits. -Xmx128m cannot be set above -Xmx178m according to a contributor there. I used -Xmx170m and solved the memory problem. If your project is too big for this memory limit, the Adobe Forum suggests that you rollback to Flash Professional CS5.5.

 

Now I'm still working on the 

 

VerifyError: Error #1079: Native methods are not allowed in loaded code.

 

I hoped that was a problem with the Flash file running on the desktop so I packaged the SWF file anyway with blackberry-airpackager. I even used some instructions in this thread: http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Build-App-with-qnx-libraries-in-FlashDe...

 

but the bar file will hang on the splash screen in the simulator and on the device (I'd hoped the sideloading on the device was a problem and the app would work in the simulator - but no).

 

since the above referenced thread has some libraries internally linked and others externally linked, can someone tell me if "framework.swc", "rpc.swc" and "rpc_rb.swc" should be linked internally or externally?

Please use plain text.
BlackBerry Development Advisor (Retired)
dmalik
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook

Re: Payment Services in Flash Professional CS6?

[ Edited ]

It seems like I forgot a step in my guide. In your app.xml file above the </application> tag at the end add:

 

<extensions>
        <extensionID>qnx.system.QNXDevice</extensionID>
        <extensionID>qnx.net.QNXNetwork.ane</extensionID>
        <extensionID>qnx.sensors.QNXSensors</extensionID>
        <extensionID>qnx.fuse.ui.skins.QNXSkins</extensionID>
</extensions>

 This is for any ANE files you're adding in your app,

 

You also need to add point to the ANE files when compiling in the command line with "-ane [location]"

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/
Please use plain text.
Contributor
bkirvin
Posts: 48
Registered: ‎09-08-2013
My Device: Z10

Re: Payment Services in Flash Professional CS6?

[ Edited ]

OK, you win.

 

I'm moving to Flash Builder. Hello World worked with the qnx library and the WiFi deployment has won me over.

 

Besides, Flash Builder opens up the possibility of using APIs Flash Professional never could.

Please use plain text.