I ran into this runtime error "Error: Could not find resource bundle rpc" when running my application which loads a remote SWF file. After a few futile Google searches (which turned up this bug report) I realized that I had compiled the remote SWF using the Flex 2.0.1 compiler instead of the default Flex 3.2. Once I changed my remote SWF to be compiled using the 3.2 compiler (this can be done under the project
Properties > Flex Compiler > Use default SDK (currently "Flex 3.2") then it all worked as expected. So I'm guessing that Flex 3 and Flex 2 SWFs don't play nicely...
Saturday, June 20, 2009
Wednesday, June 17, 2009
Creating a BevelFilter
It is remarkably simple to add a bevel filter to any DisplayObject using the filters property. You can also apply a bevel filter to a BitmapData object by calling the applyFilter() function.
The two classes that you can use are: BevelFilter or GradientBevelFilter. In the example below I use the BevelFilter because it is slightly more simple. Almost all the properties are the same, except that the GradientBevelFilter class lets you choose more than 2 colors, as well as the ratios and alpha values. Here is a GradientBevelFilter example.
Here is an example that lets you set all the BevelFilter properties and see how it affects the image on to which the filter is applied.
Most of the properties are quite self explanatory. The quality property can be set using constants defined in the BitmapFilterQuality class (high = 3, medium = 2, and low = 1). But the documentation also says that the allowed quality values are from 0 - 15, but you decrease the performance by setting the quality value higher than 3.
There are also constants for the bevel type using the BitmapFilterType class.
Adobe LiveDocs:
I'm also using the BindingUtils class to bind the bevel filter properties to the inputs (so that when the inputs change, the filter properties change too).
The two classes that you can use are: BevelFilter or GradientBevelFilter. In the example below I use the BevelFilter because it is slightly more simple. Almost all the properties are the same, except that the GradientBevelFilter class lets you choose more than 2 colors, as well as the ratios and alpha values. Here is a GradientBevelFilter example.
Here is an example that lets you set all the BevelFilter properties and see how it affects the image on to which the filter is applied.
Most of the properties are quite self explanatory. The quality property can be set using constants defined in the BitmapFilterQuality class (high = 3, medium = 2, and low = 1). But the documentation also says that the allowed quality values are from 0 - 15, but you decrease the performance by setting the quality value higher than 3.
There are also constants for the bevel type using the BitmapFilterType class.
Adobe LiveDocs:
I'm also using the BindingUtils class to bind the bevel filter properties to the inputs (so that when the inputs change, the filter properties change too).
Tuesday, June 16, 2009
Unable to export SWC oem
Ever seen this error? I just came across it today. Thankfully the solution is very simple, but it took a few minutes of Google searches to find the solution.
The problem is caused by having invalid assets selected in your Flex Library Project. Probably you've removed one or more asset files, but the project properties didn't get updated.
To fix this open your project Properties > Flex Library Build Path > Assets, then de-select all your assets, and then re-select the assets. Click OK and it should update your project properties with the correct assets.
Credits go to this useful website: FlexGarden.net
The problem is caused by having invalid assets selected in your Flex Library Project. Probably you've removed one or more asset files, but the project properties didn't get updated.
To fix this open your project Properties > Flex Library Build Path > Assets, then de-select all your assets, and then re-select the assets. Click OK and it should update your project properties with the correct assets.
Credits go to this useful website: FlexGarden.net
Labels:
export swc oem
Saturday, June 13, 2009
Full Screen support in Flex
I recently learned that you can make your Flex application full screen. Here are the steps to accomplish it:
First edit your project's html-template/index.template.html file and add the following allowFullScreen property to the JavaScript code:
You can also add the <param name="allowFullScreen" value="true"/> to the <object> tag, and allowFullScreen="true" to the <embed> tag for compatibility.
Next in your ActionScript code when the application has finished loading (when the stage isn't null) you can make your application full screen like this:
I found this out from the The Adobe Flex 3 Programming ActionScript 3 PDF on page 547.
First edit your project's html-template/index.template.html file and add the following allowFullScreen property to the JavaScript code:
else if (hasRequestedVersion) {
AC_FL_RunContent(
...
"allowFullScreen","true",
...
);
AC_FL_RunContent(
...
"allowFullScreen","true",
...
);
You can also add the <param name="allowFullScreen" value="true"/> to the <object> tag, and allowFullScreen="true" to the <embed> tag for compatibility.
Next in your ActionScript code when the application has finished loading (when the stage isn't null) you can make your application full screen like this:
Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
I found this out from the The Adobe Flex 3 Programming ActionScript 3 PDF on page 547.
Labels:
full screen
Thursday, June 11, 2009
Flex Amazon Image Search
Here's a sample application that queries the Amazon Web Services to retrieve images for CDs, DVDs, books, video games, software, etc. E.g. if you want to find the album cover for a music CD.
Here is my example - it lets you search for music, dvds, books, etc by title (and an artist for music cds, and an author for books) and then shows the resulting images ordered into 5 different image sizes. Double click an image to open the jpg in a new window.
** As Amazon keeps updating their web service this example will stop working. Please view the source code to see how it used to work!
Here are the steps to get it working in your Flex Builder:
I found this website which helped me get started:
Finding cover art with Flex and Amazon WebServices.
** August 24th, 2009 Update **
As of August 15th Amazon now requires that all requests are signed. The example above has been updated to include this change, so you can View Source to see the code.
Here are some links that I found very useful in fixing the problem:
When signing the request, I tried using the com.adobe.crypto.HMAC and com.adobe.crypto.SHA256 classes that come with the as3corelib project to create the signature, but it didn't work because the signature needs to be Base64 encoded. So instead I modified those two classes very slightly to make it work.
I also included a TestSignature.mxml application which was useful to make sure that the signature matched what the Signed Request Helper output.
Here is my example - it lets you search for music, dvds, books, etc by title (and an artist for music cds, and an author for books) and then shows the resulting images ordered into 5 different image sizes. Double click an image to open the jpg in a new window.
** As Amazon keeps updating their web service this example will stop working. Please view the source code to see how it used to work!
Here are the steps to get it working in your Flex Builder:
- Download the source code from the example above (Right click "View Source", then click the download link in the bottom left corner of the page)
- Sign up for an Amazon Web Service Account
- Copy your Access Key ID and put it in the services/AmazonItemSearch.as file
- Full details and the API for the Amazon Web Services are located here
I found this website which helped me get started:
Finding cover art with Flex and Amazon WebServices.
** August 24th, 2009 Update **
As of August 15th Amazon now requires that all requests are signed. The example above has been updated to include this change, so you can View Source to see the code.
Here are some links that I found very useful in fixing the problem:
- Getting Started - submitting your first request
- Example REST Requests (steps on how to sign the request)
- Signed Request Helper:
Use 00000000000000000000 for the access key and 1234567890 for the secret key.
Then copy the following text into the Unsigned URL textbox:http://webservices.amazon.com/onca/xml?Service=AWSECommerceServic
e&AWSAccessKeyId=00000000000000000000&Operation=ItemLookup&ItemId
=0679722769&ResponseGroup=ItemAttributes,Offers,Images,Reviews&Ve
rsion=2009-01-06&Timestamp=2009-01-01T12:00:00Z
When signing the request, I tried using the com.adobe.crypto.HMAC and com.adobe.crypto.SHA256 classes that come with the as3corelib project to create the signature, but it didn't work because the signature needs to be Base64 encoded. So instead I modified those two classes very slightly to make it work.
I also included a TestSignature.mxml application which was useful to make sure that the signature matched what the Signed Request Helper output.
Labels:
Amazon,
Web Service
Subscribe to:
Posts (Atom)
