August 29th, 2007
I have created a very basic Flex 2 RolloverImage component that allows you to define the up, over, and down images through CSS.
Here is the guts of how to use the class:
PLAIN TEXT
XML:
-
<mx:Style>
-
.firstRollover {
-
upSkin: Embed(source=”/assets/arrowGreenUp.png”);
-
overSkin: Embed(source=”/assets/arrowBlueUp.png”);
-
downSkin: Embed(source=”/assets/arrowBlueDown.png”);
-
}
-
</mx:Style>
-
<renaun:RolloverImage
-
styleName=“firstRollover”
-
click=“mx.controls.Alert.show( ‘click’ );” />
-
<renaun:RolloverImage
-
upSkin=“@Embed(source=’/assets/arrowBlueUp.png’)”
-
overSkin=“@Embed(source=’/assets/arrowBlueDown.png’)”
-
downSkin=“@Embed(source=’/assets/arrowGreenUp.png’)”
-
mouseDown=“mx.controls.Alert.show( ‘mouseDown’ );” />
For a live example click here
, the source is available by right clicking on the component or you can find it here.
Posted in Development, Flex | No Comments »
August 29th, 2007
UPDATE: see comments, the skin class works with any UIComponent and checks for many exceptions of different backgroundImage style values. Note backgroundImage values of embedded images only work, embedded SWF’s with symbol names throws an error.
I created a RepeatingImage component last month that works nicely for applying repeating images any where in your Flex application. But most repeating image usages are typical implemented as repeating background image for the whole Application. There is no easy way to apply the background image as a style and have it repeat.
You could use the RepeatingImage component to apply a image class on the Canvas of an Application component, but that might not work for non absolute layout apps. The basic code to repeat a bitmap over an graphic area requires BitmapFill. Stefan Richter modified Jemery Lu’s code to apply a bitmap image to the Application component through AS code in the Script block. This looks a lot like the RepeatingImage in its approach.
Then in Stefan’s comments Maikel Sibbald applied the BitmapFill approach to a borderSkin. This approach makes more sense when you are thinking of just applying a background image on the Application that repeats. The one done side to the code was that it you have to hard code the image source into the custom borderSkin class.
I decided to take that code and modify it so you set the borderSkin and backgroundImage styles on the Application component class to make it work. The trick is the modifications in the custom borderSkin called RepeatedBackground, they RepeatedBackground class locates the backgroundImage style from the parent (which is Application or any other component with borderSkin set to RepeatedBackground) and uses that as the class for the image. It then clears the backgroundImage style on the parent to make sure that that doesn’t get drawn.
See for your self, here is the live example and the source code through context help.
Posted in Development, Flex | No Comments »
August 29th, 2007
I downloaded the latest SDK of Flex to try out coding Flex in Ubuntu (6.06).
Here are the basic steps to try it out:
Download Flex 2 SDK for linux
Extract package to a directory (/home/renaun/Desktop/flexsdk/)
Create simple mxml file called helloworld.mxml
Run the following command:
>/home/renaun/Desktop/flexsdk/bin/mxmlc -o helloworld.swf helloworld.mxml
At this point I got a segmentation fault. Looking at the java version that comes with Ubuntu you see its a gij 1.4.2 JRE.
>java -version
java version “1.4.2″
gij (GNU libgcj) version 4.1.0 (Ubuntu 4.1.0-1ubuntu8)
To fix the segmentation fault I had to download a different JRE from Sun. I downloaded both the 1.5.0_10 and 1.4.2_13 self-extracting JREs. I extracted both in the Desktop folder. To change which java executable the mxmlc will run you need to modify the mxmlc shell script it self. On my install it was located at “/home/renaun/Desktop/flexsdk/bin/mxmlc”.
I edited the last line in the mxmlc shell script from:
java $VMARGS -jar “$FLEX_HOME/lib/mxmlc.jar” +flexlib=”$FLEX_HOME/frameworks” $*
to
/home/renaun/Desktop/jre1.5.0_10/bin/java $VMARGS -jar “$FLEX_HOME/lib/mxmlc.jar” +flexlib=”$FLEX_HOME/frameworks” $*
And that fixed the problem (both 1.5.0_10 and 1.4.2_13 work). Now onto some ant build scripts and eclipse integration….
Posted in Development | No Comments »
August 29th, 2007
There was a question on the FlashMedia mailing list about how to get id3 info from a NetStream with AS3 code. It is actually just like AS2 with some quirks to watch out for. The first is the supported ID3 tags:
About supported versions of ID3 tags
Flash Media Server supports playback of ID3 text tags in UTF-8, UTF-16, and ISO-8859-1 formats and supports ID3 versions 1.0, 2.3, and 2.4. Only tags that contain text data are supported, such as song title, artist name, comments, and year recorded.
I had a mp3 with ID3 v2.2 tags that did not work until I put in a v1.0 ID3 tag.
The next is the NetStream is not dynamic in AS3 and you use the client property to handle method calls from the server. There will be a onPlayerStatus and onId3 method call the server makes on the NetStream object.
Here is the running example and source code is available through the right click.
Posted in Example, Flex | No Comments »
August 29th, 2007
YouTube moves to the small screen
First off its a little confusing because it says,
Users who subscribe to Verizon’s Vcast service will be able to view content on the YouTube website via their mobiles.
and then states this,
The new deal will mean that VCast users, who pay $15 a month to watch and download video to their mobile, will have access to a limited number of approved videos from YouTube.
How do you go from saying that the Vcast service will be able to view content on the YouTube website and then say they will have access to a limited number of approved videos? First off, the YouTube.com website is a Flash/FLV based media player and Vcast is a Mpeg4 based service, would be interesting to know how they implemented that one. I assume this might be some of the reason for limited number of approved videos? because converting FLV to other formats right now is not something of a smooth process. But we are talking about going from a larger resolution to a smaller one so even if you are going from a compressed format to another you will be alright. Most YouTube.com movies are compressed alot though so I wonder if they are limiting it to videos they have the source to?
Well like I said this new article sparked more questions then answers. It was nice to see that they hooked up a 5-digit code to send videos to for uploading videos. This should make the expansion of social-video-networking go up quite a bit. It would be really cool, this is way out there, to have this fuel Verizon’s relationship with Adobe and push the Vcast system to use FLV (and Flash Lite 2.X/3.0???) instead of or in addition to the Mpeg4 based service of right now. Anything that pushes Flash forward on the mobile device arena is cool.
Posted in News | No Comments »
August 29th, 2007
In the days of Flex 2 beta there were some mx.automation.* classes that was the start of integrating Flex 2 with Mercury Quick Test Professional (QTP). These classes where pulled out of the Flex 2 release. At MAX I attended Alistair McLeod’s presentation on “Increasing Efficiency and Quality with Flex Automation” and found out that the mx.automation.* classes will make it into Flex 2.0.1.
A good resource on this subject is a presentation made by Ram. K back in June 2006 called “Automated testing of Flex applications”. In this document there is a diagram on page 5 that shows a Testing Tool API box with Adapters inside it.
I am interested in how people are using QTP adapter and if there are plans for any other custom adapters (I have my own ideas in this area). If you are using QTP adapter or have more information about custom adapters please leave a comment or email at renaun renaun com.
Posted in Development, Flash | No Comments »
August 29th, 2007
You can close a project in Eclipse which keeps a reference to the project but does not load the project. This keeps the Flex Builder memory usage and build times down a little if you are working in a lot of projects at one time.
From the Flex Builder help docs:
Closing and opening projects
To save memory and improve build time without deleting a project, you can close it. When you close a project, you collapse the project and its resources while keeping a reference to it in the Navigator view. A closed project requires less memory than an open project, and is excluded from builds.
To do this select the Project in the Navigator view, then right click and click on Close Project.
With a current state of 34 projects in my Flex Builder workspace the difference in startup memory usage was about 11Mb all closed to 18Mb all open. Not terrible alot of very bit counts, also this would be much higher if I had kept many files from those projects open in the Editor view. Eclipse loads each project that has a present file in the Editor view when loaded. With two files from two different projects of my 34 projects open when Eclipse is started caused it to start at 40Mb memory usage. Granted you need to use memory when you working on projects, but using the close project feature can help you manage what Projects and resources you are using more easily.
Posted in Development, Flash | No Comments »
August 29th, 2007
The ability to repeat an image across the X or Y axis is not straight forward in Flex/Flash.is not built into the Flex Framework. This Flex component extends SWFLoader and provides two properties “repeatX” and “repeatY”, which both control which axis to repeat the image is repeated on. The underlying code uses the BitmapFill class (thx to Alex for the tip) to draw the bitmap data onto a Sprite that fills up the SWFLoader’s container’s width and height.
To view the component in action click here!
Click here for the component’s home page and a link to the source.
Posted in Development, Flash | No Comments »
August 29th, 2007
I decided to create a mashup on top of the new Flex Search that just came out.
Background, Ted Patrick just released the Flex Search Alpha1 API. He created a basic application on top of the remoting API. The Flex Search API has the following current features:
- Search Flexcoders, FlexComponents, Flex Dev Center, Flex Documentation, AS3 Documentation and soon blog posts on flex.
- Boolean Search syntax:
Cairngorm –> Search for Cairngorm
+Cairngorm -flexcoders –> Require ‘Cairngorm’, remove ‘flexcoders’
flash.net.* –> Wildcards supported
- AMF Remoting API with server caching logic. Only unique requests hit the database as a search. 2nd request is cached. Also when the index is rebuilt, the URL’s can be replayed caching prior content.
- Search reporting and metrics for tuning. All searches are stored.
You can find more on Ted’s site here.
What I decided to do was make my own mashup using the Flex Search API. The application was a created pretty quickly so let me know if there are any issues. It lets search and browse the pages through an iFrame on top of the search results.
Here is the live example.
Right click to view the source or get it here.
Posted in Development, Flash | No Comments »
August 29th, 2007
Posted in Flash | No Comments »