Archive for the 'Embed' Category

28
Feb

Using embedded fonts with the Panel container in Flex

The following example shows how you can use an embedded font with the Flex Panel container so that a Panel container can be rotated or faded without the text “disappearing”. The trick here is to set the panel’s titleStyleName style to a custom style which sets the font family to the embedded font.

Full code after the jump.

Continue reading ‘Using embedded fonts with the Panel container in Flex’

07
Feb

Embedding fonts in a Flex application using Embed metadata

The following example shows how you can embed a font using ActionScript and the [Embed] metadata.

Full code after the jump.

Continue reading ‘Embedding fonts in a Flex application using Embed metadata’

25
Oct

Embedding fonts from a Flash SWF file into a Flex application

The following examples show how you can embed a font from a Flash SWF into a Flex application using @font-face in a <mx:Style /> block, or using the [Embed] metadata.

Full code after the jump.

Continue reading ‘Embedding fonts from a Flash SWF file into a Flex application’

09
Oct

Embedding fonts by name instead of location

The following example shows how you can embed a font in Flex by specifying the font name instead of a location by using the local() function instead of the src() function when embedding a font.

Full code after the jump.

Continue reading ‘Embedding fonts by name instead of location’

28
Aug

Styling a Flex Button control using embedded fonts

The following example shows how you can customize the appearance of a Flex Button control by using an embedded font and removing the Button’s default skin.

Full code after the jump.

Continue reading ‘Styling a Flex Button control using embedded fonts’

11
Aug

Styling the Flex Alert control

This is a more complex version of my previous example. This time in addition to making the Alert control’s text non-selectable, we use an embedded font for the Alert title, message, buttons, as well as edit the drop shadow, remove the rounded corners, and remove the button skins.

Full code after the jump.

Continue reading ‘Styling the Flex Alert control’

07
Aug

Embedding sound effects in your Flex applications

I was investigating a bug today with embedded sounds over a Remote Desktop Connection and came up with the following code that I thought I’d share.

I tested three different methods of embedding sound effects into a Flex application:
1) Using the <mx:SoundEffect /> tag, an inline @Embed, and mouseDownEffect
2) Using the [Embed] metadata, <mx:SoundEffect /> with a binding to my embedded asset, and mouseDownEffect
3) Using the [Embed] metadata, the SoundAsset class, and the SoundAsset.play() method.

Full code after the jump.

Continue reading ‘Embedding sound effects in your Flex applications’

07
Aug

Specifying certain unicode-ranges for embedded fonts

In a previous post (”Embedding and animating fonts in a Flex application“), we looked at embedding a font in a Flex application so we could animate, rotate, and set the alpha for a Text control. Well, as we learnt, sometimes embedding a whole font face can dramatically increase the size of the final SWF output. In this post we’ll look at only specifying a certain range of characters for an embedded font, which will help reduce file sizes.

Full code after the jump.

Continue reading ‘Specifying certain unicode-ranges for embedded fonts’

06
Aug

Embedding and animating fonts in a Flex application

I meant to post this earlier, and I already touched on font embedding in an earlier post (Building a basic controller for the VideoDisplay control), but here’s a quick little way to embed a font in a Flex application.

In this example we embed a font (the awesome “Base 02″ PC TrueType font (TTF) from http://www.stereo-type.net/), animate it using the Zoom effect and the Elastic.easeOut easing method. We also set the rotation and alpha properties (which you can’t do with non-embedded fonts), and we set the fontAntiAliasType to “advanced” to give the font a cleaner look. Finally we use the effectEnd event to loop the animation.

Full code after the jump.

Continue reading ‘Embedding and animating fonts in a Flex application’

05
Aug

Building a basic controller for the VideoDisplay control

OK, this is probably one of my more elaborate samples on the site so far. It covers a few different areas which I probably haven’t covered (or covered well) up to this point. We look at things like embedding fonts (so we can use the fade effect on a nested text field), embedding images for button skins, and overlaying a simple set of buttons when you move your mouse cursor over a video (which I believe iTunes and many other video players do). Basically it lets you create a nice little video player that gets overlayed on the video so you don’t have additional space taken up by play/pause buttons.

Full code after the jump.

Continue reading ‘Building a basic controller for the VideoDisplay control’

02
Aug

Adding icons to Panel containers

Personally, I’m amazed I can write an entire post around setting a single (and simple) style, but yet here I am. The following example shows how you can place an icon of your choosing in the upper-left corner of a Panel container. As an added bonus, at least I create the Panel in both MXML and ActionScript.

Full code after the jump.

Continue reading ‘Adding icons to Panel containers’

25
Jul

Embedding assets from SWF files

Another cool way to embed assets into a Flex application is to load a SWF file and embed specific library assets using the [Embed] metadata and specifying the library symbol to embed.

Full code after the jump.

Continue reading ‘Embedding assets from SWF files’

25
Jul

Embedding images using style sheets and the <mx:Style> tag

Just when you thought I may have run out of Embed examples… Here’s a quick example of embedding an PNG icon using an <mx:Style> block.

Full code after the jump.

Continue reading ‘Embedding images using style sheets and the <mx:Style> tag’

24
Jul

Embedding external files using [Embed]

OK, I learnt this trick a few weeks ago from a co-worker. A user emailed me and asked if it was possible to embed an HTML/text file in a Flex application rather than having to load the files at runtime, similar to how you can embed images or whatnot.

Not being certain, I asked the team and got this response…

Full code after the jump.

Continue reading ‘Embedding external files using [Embed]’