Unable to call save method of filerefence class in script tag of flex 3 application - actionscript-3

I am trying to call method save of filerefence call in script of flex 3 application but application doesnot show the option of save method.
Please answer this.
Thanks in advance.

right click on Project and click on properties
then goto Flex Compiler
in HTML Wrapper
Change the required Flash Player version to 10.0.0

FileReference.save() is only available for Flash player 10 and above. If your flex sdk is running with Flash 9.0 you wouldn't be able to use it. Either move to latest SDK version or implement it using different way wiothout using the save() method.

Related

Turn of Warnings in Flash Builder 4.7

Everyone know this little warnings in Flash Builder when working with Flex, something like:
warning: unable to bind to property 'blabla' on class 'BlaBla'
It´s very kind of the Flash Builder to warn me on that, but I would like to turn this off :)
I already tried using
-show-binding-warnings=false
as additional compiler argument, but this does not seem to be working.
Has anyone out there managed to turn this off in Flash Builder 4.7 using Apache Flex ?
If you're having a Flash project go to:
Project>Properties>ActionScript Compiler
There just tick off the Enable warnings checkbox.
If you're using Flex instead of pure AS3 go to:
Project>Properties>ActionScript Compiler>Flex CompilerAnd tick off the Enable warnings checkbox.

class not found in Actionscript error

I am trying to run the program from http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf61c8a-7ff4.html
I am using Adbobe builder version 4.6 i encounter this problem WAVwriter class not found
when i do import com.adobe.audio.format.WAVWriter;
Also var outputFile:File = File.desktopDirectory.resolvePath("recording.wav"); File type is not found..
How to resolve this error
Exactly as Adnan Doric said. And if you want to output your file using Flash Player runtime (instead of AIR), you should use flash.net.FileReference class. Calling its dowload() method will pop up an external dialog which can be used to save your file.
File is an AIR class, make sure your project is for desktop or mobile (AIR). If not, you can make new desktop project by going to File/New/Flex Project... and check in the Desktop checkbox (for mobile, choose Flex Mobile Project).
Regarding WAVWriter, make sure you linked the related sources.

VerifyError: Error #1014: class could not be found

I'm developing AS3 project using Flash Builder 4.5 (also with library Away3D 4.0 and Flex 4.5.1 SDK).
Also, I add my own SWC library, which I compile previously into my project.
It works find if I import class in my SWC library, however I want my swf run in a stand-alone flash player 11.
I follow this tutorial:
http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-4dd43be212e8f90c222-7ffb.html
Now, I could run my app in a flash player 11, but I got an error in run time:
VerifyError: Error #1014: XXX class could not be found
And XXX is my class in SWC library. How should I fix this?
Merged into code means this, in project properties -> Flex Build Path -> Library Path -> Framework Linkage. Framework lingage has two options Merged into code and RSL. Chose Merged into code. This should solve your problem.
We had this problem when trying to build a project using a Native Extension.
Classes within the NE weren't being found at runtime, but were accessible in Flash Builder.
It turned out that by default the .ANE file wasn't copied to the device.
To fix this, change the following project property:
ActionScript Build Packaging -> Apple iOS -> Native Extensions -> Check 'Package' for the ANE
No idea why it wasn't included by default. When you uncheck 'Package' you get a warning telling you that it may cause runtime issues!
In my case, we had a nested reference to the same library which needed to load before the other library also using it. This fix can be accomplished by unchecking the 'Automatically determine library ordering based on dependencies' and moving the library up in the chain of Build path libraries. Flash Builder was unable to determine the correct order base on dependencies because we had 2 different versions of the same library. The error would only happen during run time.
I had this problem after installing AIR 3.9 and trying to upgrade a project.
It was also saying there was an RSL error, before throwing a succession of #1014 errors.
It worked after I set the textLayout.swc link type in Advanced ActionScript Settings to 'merged into code' instead of the default (RSL)
Hope this helps!
Since I landed on this page searching for this error message and none of the above solutions worked for me, here's how I finally managed to work around it:
It seems that this error happens particularly when you include old libraries that were compiled with the old compiler but compile your app with the new one. Unfortunately the error sometimes fires and when you compile again it doesn't; at other times it works fine in the debug version but then it fails in the release.
What worked for me is to include dummy objects in your main app which are instances of the class that the verify error complains about:
import some.classpath.to.TheClassThatFailsOnVerify;
function YourMainApp(){
var dummy:TheClassThatFailsOnVerify = new TheClassThatFailsOnVerify ();
}
At least in my case the errors only fired for classes that were not used directly in the app but only internally in the swc library code, so by having the dummy objects in the main app I force Flash Builder to include those classes in the compilation.
In some cases you might have to first find the swc that contains the class in question since it's not part of the library swc you use but it's again a library that that swc uses itself.

automation errors in Flex Builder 3 when importing a swc from Flash CS 5

I am facing a really weird issue while trying to use an "swc" file imported from Flash CS5, that I am trying to use in Flex Builder 3 (by converting symbol to "Flex Component"). The errors are coming in files which are not even remotely related to the "swc" file that i am importing.
Now, I know that the automation stuff has come as a part of FB4, but I don't really have an option to migrate to FB4.
I have tried to change the flex sdk settings in Flash CS5 (steps given below), but that has not helped.
Edit-->Preferences-->Actionscript-->"Actionscript 3.0 Settings"-->"Flex SDK Path" (pointing this to flex3.5 sdk instead of Flex4.0 sdk)
I feel that the issue is most probably a compatibility issue b/w Flex 3 and Flex 4, but have not been able to find a workaround for the same. Any help is greatly appreciated.
Thanks,
Kapil
Here is the trace:
Severity and Description Path Resource Location Creation Time Id
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.view.ui:SchematicWindow.
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.controls:CloseableTabBar.
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.layouts:DockedAppLayout.
OK, first, the error: this means that Flash probably generated a class for the symbol you are importing using a certain template, where the template doesn't fit the SDK you are using to compile the project. Specifically, the generated class did not implement the methods listed in the error message. I.e. your framework.swc has a definition of mx.automation:IAutomationObject that has method createAutomationIDPartWithRequiredProperties() (nice name btw), but Flash generated code that reads as
package com.sparsha.view.ui {
import mx.automation:IAutomationObject;
public class SchematicWindow implements IAutomationObject { . . . } }
Since you cannot do anything about Flash not generating the method you need, your only way is to monkeypatch the SDK. I.e. copy the mx/automation/IAutomationObject.as from the SDK sources to the classpath of your project. Remove the conflicting method declaration (this may or may not result in other errors). If it results in further errors, repeat the same procedure for every class that "misbehaves"...
However, monkeypatching will mean that you are no longer able to use framework RSLs, as they will come with the original version. So, I would try to avoid the problem altogether and look for another way of exporting symbols from Flash IDE, for example, by not making them a Flex component. Or, if you really insist on them being a Flex component, then bootstrap the FlexSprite, for example, and assign your Flash symbols the bootstrapped class as the "parent class".
I was also having this problem recently. I would get the errors when I included the flash generated swc in my flex projects lib folder.
I was able to work around the issue by upgrading my flex to the flex 4.5.1.21328A SDK.
Additional Details about my project that might help others:
My swc was generated from Flash Professional CS5.5 and my Flex Project was being used in Flash Builder 4.5.
My swc was published to Flash Player 9 with ActionScript 3.0.
My flex project was using the 3.5.0.12683 SDK.

"Definition mx.utils:Base64Encoder could not be found" in Flex Builder 3

I'm trying to edit an existing AS3 application (which was built using Flash Develop) in Flex Builder 3.
The application uses Base64Encoder (using "import mx.utils.Base64Encoder"). This compiles without problems in Flash Develop but trying to build it in Flex Builder 3 (Mac version) gives an error:
"Definition mx.utils:Base64Encoder could not be found"
Indeed when using code completion (ctrl + space) in flex, on "import mx.utils." only 4 utils are shown in the list.
I've tried this using the Flex 3.2.0 sdk that came with Flex Builder 3 and the Flex 3.5.0 sdk which I downloaded from the adobe website.
Does anyone know why this might be? and how I could resolve this?
Thanks.
I've fixed this by adding 'framework.swc' to my library build path.
Instructions:
Right-click project and select 'properties'
Select Actionscript Build Path
Select 'Library Path' tab
Click 'Add SWC...' button
Enter [path to your sdk]/frameworks/libs/framework.swc
Click 'OK' to add swc
Click 'OK' to close properties
Re-build your project
You need to include [SDK]/frameworks/libs/rpc.swc file from Flex SDK
It's probably borrowed from the Flash class lib rather than the Flex one. There are plenty of base64 implementations out there that you could substitute.