Archive for the ‘Adobe Flex’ Category

How to Access Flex 3 VideoDisplay CuePoint Parameters

Tuesday, December 7th, 2010

Unfortunately when adding cuePoint event listener to mx:VideoDisplay component in Adobe Flex 3 you only receive name, time and type of the Cue Point. Here is a dirty workaround to access the parameters from the metadata.

<?xml version="1.0" encoding="utf-8"?>
<s:Application 
               minHeight="600"
               minWidth="955"
               xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            import mx.core.mx_internal;
            import mx.events.MetadataEvent;
            import mx.utils.ObjectUtil;
 
            protected function videoDisplay_metadataReceivedHandler(event:MetadataEvent):void
            {
                videoDisplay.mx_internal::videoPlayer.addEventListener(MetadataEvent.CUE_POINT, videoPlayer_cuePointHandler);
            }
 
            private function videoPlayer_cuePointHandler(event:MetadataEvent):void
            {
                trace(ObjectUtil.toString(event.info.parameters));
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
    </fx:Declarations>
 
    <mx:VideoDisplay id="videoDisplay" source="video.flv" metadataReceived="videoDisplay_metadataReceivedHandler(event)"/>
</s:Application>

LineBreak / NewLine in Flex Text Control from XML String

Wednesday, October 27th, 2010

Unfortunately the standard way (‘\n’)  of inserting new lines in Flex Text Controls (Label, Text etc) doesn’t work when the string comes from XML.

The magical way to do it is by using ‘&#13;‘ so

Lorem&#13;Ipsum becomes

Lorem
Ipsum

Embed Font in Flex4 Actionscript Project

Sunday, April 25th, 2010

A quick tip for all not seeing their embeded fonts when compiling pure AS project with Flex SDK 4:

[Embed(source="assets/fonts/my-cool-font.otf", fontFamily="CoolFont", fontWeight="normal", mimeType='application/x-font', embedAsCFF='false')]
private var MyCoolFont:Class;

Notice the embedAsCFF=’false’, this is the most important part. Basically when not using Spark Text Components (which are based on Text Layout Framework) you need this option.

In summary Halo Components or pure Actionscript Projects (TextField) need embedAsCFF=’false’ when embeding fonts in Flex4.

Custom Skinnable Slider Component for Adobe Flex 3

Friday, August 14th, 2009

First of all let me apologize for not blogging in a while but I’ve been working on couple of interesting projects after which it was time for deserved vacation on the BlackSea’s beaches.

Anyway I needed a better looking horizontal slider for one of the projects and all of my googling got me nothing reasonable (most of the tutorials were for changing the Thumb and leaving the default TrackHighlight) so I had to figure out something. Here is my horizontal slider, it is pretty basic but you can use it as a base for your needs. Corner Radius and Background Gradients are set via CSS, width and height are flexible too. Check the example and get the source code.

To view this page ensure that Adobe Flash Player version 9.0.124 or greater is installed.

Get Adobe Flash Player

Install Adobe Flex Builder Alpha on Debian

Sunday, October 7th, 2007

After bumping my head against the monitor for couple of minutes i have successfully installed Adobe Flex Builder Linux Public Alpha on my Debian Unstable Linux. Here is the procedure:

1. wget http://download.macromedia.com/pub/labs/flex/\
flexbuilder_linux/flexbuilder_linux_install_a1_100207.bin

2. apt-get install eclipse sun-java5-bin

3. update-alternatives –config java
(set /usr/lib/jvm/java-1.5.0-sun/jre/bin/java to be used)

4. run the installer

Enjoy