I need to import something in order to use JSON in AS3? - json

When using the following codeline:
var myjson:Object = JSON.parse("path_to_my.json");
I got the following error:
1120: Access of undefined property JSON.
I had to import any package in order to use the JSON.parse?
Thank you!
[with: Flash CS5 (11.0.0.485), AS3]

JSON is built in to the ActionScript default package starting at Flash Player 11, and is notably higher performance than 3rd party serializers.
With Flash CS5, you need to update the target Flash Player from the Publish Settings. By default it will target up to Flash Player 10.2.
Adobe has a blog regarding Adding Flash Player 11 support to Flash Pro CS5 and CS5.5.
At that page you will find an extension (MXP) install as well as manual instruction of updating Flash Player to 11.
Load CS5 or CS.5 MXP with Adobe Extension Manager, and you will be able to target Flash Player 11.0 from your Publish Settings:
Note that JSON parse takes an object, and not a path to a file.  Your code should give Error #1132: Invalid JSON parse input.

Related

Type was not found or was not a compile-time constant: StageWebView

I am using flash builder 4.0 and am getting the following error. I have tied both 3.5 SDK and 4.0 SDK and set the flash version to 10 or above. I also tried a friends computer with flash builder 4.5 but could not resolve the error either.
Based on the Adobe link below StageWebView is part of AS3 which as I understand should be included with my current project as part of the flash.media.* group but I don't see it when I type the import statement.
Can someone tell me how to add StageWebView to a project or what I am doing wrong?
Error message:
Type was not found or was not a compile-time constant: StageWebView
Related link:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageWebView.html
StageWebView and many other classes are just for use with Adobe AIR, although they are included in the flash packages. sometimes also object methods are only available to AIR.
you recognize what is available only to AIR by the little red triangle logo in the reference.
Adobe AIR is not available in the web plugin. It is used to create "standalone" applications for desktop and mobile.

How to set swfversion

I know this seems like a silly question but how can I change the swfversion that Flash Pro sets when it builds the SWF?
I'm using a 3rd party ANA and I'm getting an error message that the SWF for that ANA is greater than my SWF when it publishes the SWF.
Thanks.
In the publish settings (File -> Publish Settings), there should be a dropdown where you can select the Target flash player. I'm using Flash CC and the range it allows me is 10.3 to 11.8.

AS3 SecureSocket addBinaryChainBuildingCertificate not avaiable?

I want to use the addBinaryChainBuildingCertificate() method of the SecureSocket to setup a connection to a HTTPS/SSL Webservice. But this method is not avaiable inside the flash platform. I got this error:
ReferenceError: Error #1069: Property addBinaryChainBuildingCertificate not found on flash.net.SecureSocket and there is no default value.
So I`m wondering. Is this method only avaiable when using Flash builder and Flex? I have Flash CS5 and Adobe air 3.8 installed.
I read the reference:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SecureSocket.html
They said you can use it, but it is not mentioned in the paragraph: "Public Methods"
you need to compile as an App (i.e. native binary for iOS or Android) not as Flash. Not all methods and classes are available to Flash (i.e. SWF for web)

How can I do simple streaming of a video file using Akamai?

I'm a C# developer completely new to Flash but am attempting to stream a file from Akamai's HD Network using their HD Flash 1.0 configuration.
I have "imported" the video already deployed on the Akamai network, but it seems there is a step where I have to somehow leverage an SWC component to actually make the connection to Akamai work properly.
The docs provided are all using what appears to be a much older version of Flash and don't include an FLA file. However, part of their docs do make it sound trivial to someone more versed in Flash:
Akamai HDNetwork v1.0 - HTTP delivery of FLV files, compatible with
Flash player 10.0 (we call it HDN1 for short) - combine a base NetConnection connected to "null" with a com.akamai.hd.HDNetStream. Follow the samples inside the samples\HDN1.0 folder to find out how to do basic live playback, basic VOD, multi-bitrate
playback, manual switching, sub-clips, and token authentication.
And also:
com.akamai.hd.HDNetStream— is used for HD Flash 1.0 Streaming
I placed the SWC file in the same folder as the FLA I'm working in, and included this code in the Actions window:
import flash.net.NetConnection;
import com.akamai.hd.HDEvent;
import com.akamai.hd.HDNetStream;
trace("Hi!");
// Magic happens here
.. but I just get compilation errors that the import definitions can't be found. So...not off to a good start.
All I want to do is stream the video - no multi-bitrate configurations or anything crazy - just how to get videos playing using our own SWF files. Does anyone know the easiest way to get up and running with this?

Include MX library to Flash CS5 project

I need to use some classes belong to mx library, but when I try to import it Flash throws me an error that it can't find this library.
How can I import it to my project? I'm using Adobe Flash Professional CS5.
You may try downloading the Flex SDK, get mx.swc from Flex\frameworks\lib and add it to your library path (ActionScript Settings > Library Path) in Flash CS5.