Hi, I am a beginner in AS3 and came across this particular error:
VerifyError: Error #1014: Class JSON could not be found.
at Function/http://adobe.com/AS3/2006/builtin::apply()
at flash.external::ExternalInterface$/_callIn()
at Function/<anonymous>()
I was trying out the native JSON and everything seemed to be fine on the IDE (FlashDevelop). I am also using Flash Player 11, Flex SDK 4.6.0 and AIR 3.1 as describe on Adobe AS3 Native JSON
Any ideas?
Please make sure that you have Flash player 11.2 playerglobal.swc located at:
\frameworks\libs\player\11.X
where X denotes the Flash player 11 release version 1,2,3. Please also note that you need to specify the following in teh compilation constants:
-swf-version=13 (FP11.1)
-swf-version=15 (FP11.2)
Once you do that, you should be able to get the native JSON API working.
Related
I'm getting the error even though the import is not throwing errors:
1046: Type was not found or was not a compile-time constant: EncryptedLocalStore.
Here is my code:
import flash.data.EncryptedLocalStore;
var str:String = "Bob";
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(str);
EncryptedLocalStore.setItem("firstName", bytes);
var storedValue:ByteArray = EncryptedLocalStore.getItem("firstName");
trace(storedValue.readUTFBytes(storedValue.length)); // "Bob"
EncryptedLocalStore.removeItem("firstName");
I've checked and EncryptedLocalStore was introduced in AIR 1.0 (or 3.0). I'm using AIR 3.6. I'm also using this in a library project.
It's strange. I was somehow able to get rid of the errors by doing the following:
Clean
Restart
Select Include Adobe AIR libraries in the Project Properties > Compiler settings
Add -swf-version=19 to compiler arguments
Clean
Choose Use minimum Flash Player version
Clean
Change to different SDK
Clean project.
NOTE: It's working at this point. I then reversed back through those changes and after doing the following it still works.
Change back to original SDK
Clean
Uncheck Include Adobe AIR libraries in the Project Properties > Compiler settings
Clean
Remove -swf-version=19 from compiler arguments
Clean
Remove Use minimum Flash Player version and enter Flash Player 15.0.0
I'm back to where I started but now it's working?
UPDATE:
OK I figured it out:
Select "Include Adobe AIR libraries"
Switch SDK (Clicking apply doesn't work)
Errors should go away
Switch back to previous SDK
For some reason, when I use package_as3 in FlasCC I can't import any classes to use as a var.
package_as3
(
"#package private\n"
"import flash.system.MessageChannel;\n"
"var mc:MessageChannel;\n"
);
When I try to build anything that has this code in it, I get this:
Error: Type was not found or was not a compile-time constant: MessageChannel.
whenever I use the compiled SWC in Flex.
EDIT:
This doesn't just apply to flash.system.MessageChannel; it seems to happen to anything that gets imported.
A few things to try out
Syntax
I don't think you are supposed to wrap each line in quotes, nor add \n for string termination, so that's one thing that need mending.
SDK
The MessageChannel class requires SDK version 4.6 and above so did you select the correct SDK and add it to your buildpath?
Runtime
Also the MessageChannel interface did not get run-time support until version 14.0.0 (AIR or Player), so in project properties -> ActionScript Compiler, did you set the 'Require Flash Player Version' to version 14.0 or above?
I have a problem using Sociodox BASE64 LIBRARY library.
I’m totally newbie in Flash so please help.
I’ve connected the library with
import com.sociodox.utils.Base64;
After that I try to compile my project but get the following error:
Base64.as, Line 146: 1100: Syntax error: XML does not have matching
begin and end tags. Base64.as, Line 146: 1084: Syntax error: expecting
rightbrace before end of program.
Here is a screenshot of the errors:
Please advise!
It looks like the code uses short Vector initialisation syntax: new <int>[] which your compiler tries to interpret as XML.
What are you using to compile? Flash or Flash Builder? I know that Flash Builder 4.7 should be able to handle this syntax, at least when you're compiling with an AIR SDK that contains the new ASC2 compiler.
I build a mobile app with Flash Builder 4.6 and openscales 2.2
I used openscales 1.2.1 and it works fine, but it is very slow and the zoom effect isn't nice.
So I want to upgrade to openscales 2.2.
I added the .swc to my libs folder and I change FeatureLayer to VectorLayer, because this was renamed in the new version.
If I test the app the debugger gives me the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.openscales.core::Map()[D:\workspace\openscales\target\checkout\openscales-core\src\main\flex\org\openscales\core\Map.as:296]
at org.openscales.fx::FxMap()[D:\workspace\openscales\target\checkout\openscales-fx\src\main\flex\org\openscales\fx\FxMap.as:70]
at views::mapView/_mapView_FxMap1_i()
at views::mapView/_mapView_Array1_c()
at mx.core::DeferredInstanceFromFunction/getInstance()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\DeferredInstanceFromFunction.as:108]
at spark.components::SkinnableContainer/createDeferredContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1049]
at spark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1078]
at spark.components::SkinnableContainer/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:885]
at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]
at spark.components::View/initialize()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\View.as:999]
at views::mapView/initialize()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]
at mx.core::UIComponent/addChildAt()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]
at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037]
at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]
at spark.components::Group/addElementAt()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1387]
at spark.components::Group/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1345]
at spark.components::SkinnableContainer/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:761]
at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:2018]
at spark.components::ViewNavigator/commitNavigatorAction()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1932]
at spark.components::ViewNavigator/commitProperties()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1301]
at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8219]
at mx.managers::LayoutManager/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:813]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
D:\workspace\openscales\target\checkout\openscales-core\src\main\flex\org\openscales\core\Map.as:296]
This line is really strange, because I don't have this folder on my pc and because of that I think there is a wrong path in the .swc of openscales?
Best regards
Janine
I had the same problem, I created the project on my mac with the wrong windows path ORZ....
But the problem has been solved after reading the source code.
In the class file named "org.openscales.core.Map.as", about line 300th.
var menu:ContextMenu = new ContextMenu();
menu.hideBuiltInItems();
var notice:ContextMenuItem = new ContextMenuItem("Powered by OpenScales");
notice.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openLink);
menu.customItems.push(notice);
contextMenu = menu;
The contextMenu is not supported in an air mobile application. So, just comment them and rebuild the openscales lib.Good luck.
I am developing a Flash application (Flash Player 11 as target platform) that uses the AS3 Facebook API, which in turn uses as3corelib JSON functionality. Or at least it should do so.
However, in spite of including the latest version (.93) of the as3corelib.swc, I still get the "Error: Access of undefined property JSON". I also tried including the sources directly, to no avail.
Any ideas what I am doing wrong?
As I said, the *.swc is definitely included. As is the source code (all at the correct path).
Edit:
I have a more specific error message:
Error: Can not resolve a multiname reference unambiguously. JSON (from C:\Coding\FlashDevelop\Tools\flexsdk\frameworks\libs\air\airglobal.swc(JSON, Walker)) and com.adobe.serialization.json:JSON (from C:\flash_test\lib\as3corelib.swc)) are available.
I know that JSON is included in AIR, but I do not target AIR, so why does it try include the airglobal.swc?
Your problem is that Flash Player 11 and onwards has native JSON support, so the JSON class you are including is likely colliding with the one from as3corelib. Hence the ambiguity problem.
Try removing as3corelib entirely and see what happens.
Specify the full path to the class. Example, code:
...
var jsonData:Object = JSON.decode(loader.data);
...
will be
...
var jsonData:Object = com.adobe.serialization.json.JSON.decode(loader.data);
...