• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

[AIR 3.0] New JSON functionality doesn't work in FlashPro: Error #1065: Variable JSON is not defined

Engaged ,
Oct 04, 2011 Oct 04, 2011

Copy link to clipboard

Copied

After upgrading the AIR SDK to 3.0 in Flash Professional CS5.5 I've found some problems.

First, the JSON class in the as3corelib.swc library now throws a couple of compile errors:

1061: Call to a possibly undefined method decode through a reference with static type Class.

1172: Definition com.adobe.serialization.json:JSON could not be found.

At first I was completely puzzled, since I had the proper "import com.adobe.serialization.json.JSON;" reference,

and I had the "as3corelib.swc" referenced in my ActionScript Properties, so how could that not be found?

Then, I found out that's because it conflicts with the new internal JSON class included with AIR 3.0

(maybe it should have been called something else, to avoid conflicts with Adobe's own as3corelib library).

The new native JSON class doesn't have the decode() method. Now it's called parse()

Ok, so I've tried using the new JSON class, but after changing decode() with parse() and removing

the "import com.adobe.serialization.json.JSON;" reference, Flash tells me that "Variable JSON is not defined".

Really? The JSON class is showing in the Flash Builder code completion popup,

complete with its all-new parse() and stringify() methods! So why does it say it's not defined?

Also, my SWF file gets compiled with no errors at all, so that verifies that the new 3.0 libraries are in place.

I only get the "JSON is not defined" error at runtime in ADL, not at compile time. Why?

In order to upgrade to the AIR 3.0 SDK, I've followed this guide:

http://kb2.adobe.com/cps/908/cpsid_90810.html

I know that's about upgrading to AIR 2.7, but I suppose the steps to upgrade to AIR 3.0 would be very similar,

only with the AIR3.0 SDK package, instead of 2.7.

I also took care to type version="13" in all the XMLs, instead of version="12" as stated in that guide, which is meant for 2.7.

Also, I followed this advice about adding -swf-version=13 in the Project Properties window in Flash Builder:

http://blogs.adobe.com/cantrell/archives/2011/08/how-to-use-the-air-3-beta-sdk.html

But that doesn't seem to make a difference, since, even though I use Flash Builder for code editing (which is usually used for Flex),

my project is a Flash Professional project, not a Flex one, and when testing the project, Flash Builder runs Flash Professional

to compile and then runs adl.exe (it's the same as if you click the option "Control / Test movie / in AIR Debug Launcher (Mobile)" inside Flash Pro).

In the "ActionScript Settings" window in Flash Professional, I also have the proper airglobal.swc referenced (from the AIR 3.0 SDK),

and the same airglobal.swc is referenced in Flash Builder as well (in "Referenced Libraries"), to get proper code completion.

I've tried all sorts of things to try to get it to work, but no luck. Still get the "JSON is not defined" error at runtime.

I'm starting to get desperate about this. I'm going to have to revert back to AIR 2.7.1, to stop wasting time on this issue.

BTW, I'm also having another unrelated problem (though maybe it happens because of the same reason as the other problem).

Now Flash Builder underlines the getTime() method in my code, as if it no longer were a method of a Date class instance.

I have a line where I ask for the timestamp like this:

ts = new Date().getTime();

That has worked perfectly fine up until now with AIR 3.0.

Now, when hovering the mouse cursor over the orange "(?)" icon that appears at the left, Flash Builder tells me

"Access of undefined property getTime". Why?

The AS3 documentation doesn't say anything about getTime() getting deprecated of anything of the sort:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html

In fact, in the code completion popup that Flash Builder shows, now there isn't any mention

of get or set methods, as you can see here:

http://img836.imageshack.us/img836/4793/dateinstancepopup.png

I suppose I can use the .time property instead of .getTime() but I don't know why I'm not getting all the methods I had available before.

Any ideas why all this is happenning? Specially the dreaded "JSON is not defined" error.

TOPICS
Performance issues

Views

18.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 04, 2011 Oct 04, 2011

Well, after much tinkering, I think I've finally found a way to finally make it work!.

I've created some modified XML files with the profiles needed for AIR 3.0 and after a lot of tries, it finally works!

I've uploaded them here: http://www.mediafire.com/?d5e761frl5px4

These are the steps needed to get AIR 3.0 running properly:

  1. Put all three files into the folder "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Players"
  2. Then, make sure you've unzipped the AIR 3.0 SDK into the fold
...

Votes

Translate

Translate
Engaged ,
Oct 04, 2011 Oct 04, 2011

Copy link to clipboard

Copied

Well, after much tinkering, I think I've finally found a way to finally make it work!.

I've created some modified XML files with the profiles needed for AIR 3.0 and after a lot of tries, it finally works!

I've uploaded them here: http://www.mediafire.com/?d5e761frl5px4

These are the steps needed to get AIR 3.0 running properly:

  1. Put all three files into the folder "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Players"
  2. Then, make sure you've unzipped the AIR 3.0 SDK into the folder "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\AIR3.0" Do not overwrite the contents of the "AIR2.6" folder, as suggested by the "Overlay AIR SDK" article (linked in the above post). It gave me problems. It's best to use a different separate folder. My XML files point to that new "AIR3.0" folder.
  3. Inside the folder "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\ActionScript 3.0" create a new folder named "AIR3.0". Inside that folder, copy the file "airglobal.swc" located at "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\AIR3.0\frameworks\libs\air".
  4. Finally, you will have to keep the file "descriptor-sample.xml" in the "c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\AIR2.6\samples" folder, but change the xmlns attribute to "http://ns.adobe.com/air/application/3.0"

Yes, you have to change that inside the AIR2.6 folder even if the SDK has been put into AIR3.0. That's because of how the publish settings work in Adobe Flash. It's hardcoded into a DLL, so that can't be changed. Not very intuitive.

I think AIR SDK installations should be a lot more straightforward than this! I know Adobe AIR is meant for developers, not for final users, but still, all these not very well documented upgrade procedures are a pain in the ass. I've wasted A LOT of hours in this (more than half a day), with what should have been a straightforward upgrade!

Adobe should make a SDK installer so we do not have to be tinkering with all these error-prone procedures each time a new update is released!

Well, I hope those XML files are useful to somebody and avoids further frustration.

Regards,

OMA2k

PD: BTW, I still have the .getTime() issue described in my above post, but it's not very important,

since I can still use the .time property. Still, it puzzles me why this is happening.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 06, 2011 Oct 06, 2011

Copy link to clipboard

Copied

I've realized the XML for iOS didn't work properly. I've uploaded a new iOS_AIR3_0.xml file replacing the old one in the same MediaFire URL linked above (you'll see it has newer date than the other files).

The problem with the old XML was that it had a <name> other than "AIR for iOS" (I had written "AIR 3.0 for iOS" to differentiate from the old version). It seems Adobe Flash CS5.5 looks for this string. If it's "AIR for iOS", then Flash presents the appropriate options for iOS in the "AIR for iOS Settings" window, but if that string is anything else than "AIR for iOS", then the settings shown are the AIR desktop ones. The only problem now is that you can't have 2 iOS options coexist (2.7 and 3.0) so you'll have to move the "AiriPhone.xml" file out of that folder to use the new XML for AIR 3.0 for iOS.

So you're changing the application behaviour based on the content of a string rather than an ID?! What about localization? I haven't tried localized versions of Flash CS5.5, but I suspect that string can't be translated, or else that settings window won't work.

So the AIR SDK has some hardcoded folder names in its DLLs, and Flash Pro CS5.5 changes AIR settings behaviour based on an English string which is shown to the user in the menus, instead of using an ID or any other variable... Not very polished, I think.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2011 Oct 07, 2011

Copy link to clipboard

Copied

Unbelievable!

Hey Adobe, wake-up!!!  We need a formal procedure to overlay 3.0 over CS5.5, plz.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Oct 08, 2011 Oct 08, 2011

Copy link to clipboard

Copied

Hi,

In the near term until AIR 3.0 is included in shipping versions of Adobe tools, developers can submit a request to be included in the Flash Pro pre-release program (https://www.adobe.com/cfusion/mmform/index.cfm?name=prerelease_interest) to build AIR 3.0 apps.  Another option for developers is to access AIR 3.0 through the command line with your current development tool.

Thanks,

Jian

Adobe Flash Runtime team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2011 Oct 12, 2011

Copy link to clipboard

Copied

Thanks, but when will we get a patch or procedure to overlay AIR 3.0 in Flash CS5.5?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Oct 20, 2011 Oct 20, 2011

Copy link to clipboard

Copied

Hi all,

Please view this link for the instructions for overlaying the AIR 3.0 SDK in Flash Professional CS5.5: http://kb2.adobe.com/cps/908/cpsid_90810.html

Thanks,

Jian

Adobe Flash Runtime team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 20, 2011 Oct 20, 2011

Copy link to clipboard

Copied

Jian, read the topic. Your instructions not correct and not working for native JSON support for example.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 17, 2011 Oct 17, 2011

Copy link to clipboard

Copied

THANK YOU!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 17, 2011 Oct 17, 2011

Copy link to clipboard

Copied

Glad to see this helped someone

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2011 Nov 11, 2011

Copy link to clipboard

Copied

Thanks so much for this, huge time saver.

About to update to AIR 3.1, any suggestions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 11, 2011 Nov 11, 2011

Copy link to clipboard

Copied

Hello, I've uploaded the upgraded files for AIR 3.1 here:

http://www.mediafire.com/?2btbk0x9i9gdy

You can compare the XML files for AIR 3.0 and AIR 3.1 and you'll see

it's actually just a few easy modifications.

To install AIR 3.1 just follow the same steps posted above, but changing all instances of "3.0" to "3.1"

All three XML files go here:

c:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Players

Remember that you can't have several XML profiles for "AIR for iOS" in the same folder.

So delete or move the old files "iOS_AIR3_0.xml" and "AiriPhone.xml", if you have them.

On the other hand, you can have several XML profiles for Android and Desktop,

so you can leave the old "Android_AIR3_0.xml" and "AdobeAIR3_0.xml" files if you wish.

Hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2011 Nov 15, 2011

Copy link to clipboard

Copied

Thanks so much, really helpful!  If you're ever in the UK near Bristol / Hereford hit me up and i'll get you a beer 😃

Cheers,

Matt / MSFX

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 15, 2011 Nov 15, 2011

Copy link to clipboard

Copied

Heh, thanks, I'll hold you to that

Cheers from Spain!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2012 Jun 20, 2012

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines