"Definition mx.utils:Base64Encoder could not be found" in Flex Builder 3 - actionscript-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.

Related

Can you debug swc in flash builder

Can you debug and step through the code of a swc files in flash builder?
Let's say you even have access to source code (coming from flex library project or flash professional project)! If how?
Thanks
Yes you can, though there are some limitations (as FlashBuilder will tell you when you do it), but simple stepping is no problem.
If you have the source code in a project in FlashBuilder, FB should find the associated code automatically. If you don't you can associate the source code to the swc manually. Go to the Flex Build Path window; click on the arrow next to the swc; double click the row that says "Source attachment" and enter the path to the source code.

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.

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

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.

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.

FlexBuilder to FDT Migration

I'm new to FDT and I'd like to move some (actionscript)projects from FlexBuilder to FDT.
I've noticed FDT can read .actionscriptProperties from FlexBuilder, so just setting the workspace to my FlexBuilder workspace got the projects, the current one open, the rest of them closed which is great.
I got a an error on the way:
"Error opening the editor.
No editor descriptor for id com.adobe.flexbuilder.editors.actionscript.ActionScriptEditor"
which makes sense...I the last editor used was the as editor from flexbuilder, which isn't present in fdt...no biggie here.
My problem is that I don't get the FDT autocomplete working, not even for the default AS3 classes( Sprite, TextField, etc. )
I've tried right clicking the project then Flash Project > Remove Flash Nature
then Flash Project > Add Flash Nature again...but it didn't seem to do anything.
I don't even know what it does. I'm guessing it's telling FDT to treat this project as CS3 or Flex compiled project.
I've also imported a project from SVN in FDT and no autocomplete.
So, how do I get the great FDT auto-completion for a FlexBuilder Actionscript Project opened in FDT ?
The currect version of FDT ships with an "Flex project importer". In the flash explorer under "Import -> Import Flex Builder 3 Projects".
I think I must be satisfied with the answer that there is no easy answer. The is no lazy-man's option of just opening a flexproject in fdt just like that and having everything working.
So I guess the answer would be using Export/Import.