Archive

Author Archive

Flex and UTF-8

May 4th, 2009

Flex fires unexpected errors during compiling, if we use in german so called “Umlaute” in the code- or targeting UTF-8 encoding. Unfortunately the UTF-8 XML-tag at the head of any Flex code ducument is not enough to reach the “freedom of UTF-8″. The document itself has to be saved UTF-8 encoded. This could be done by using an editor like Notepad++ or any other program containing save options like “save as UTF-8″.

stevie AIR 1.5, Action Script 3, Flex 3

Flex Sub-States

April 15th, 2009

Flex states are wonderful. What if we need substates?
A closer look to the lifedocs shows us an attribute which is providing this. The so called “basedOn-attribute”.

The mx:State tag has the following attributes:

  mx:State
  Properties
  basedOn="null"
  name="null"
  overrides="null"

stevie Flex 3

Adobe AIR Install Badge Cyan Effect

March 19th, 2009

I had some problems to find a way to remove this light cyan effect on Grant Skinners custom install badge. And I was wondering to see so many badge implemantations still keeping this effect on there logo. So I was in in touch with the Adobe team.

badge_hint

They say that the badge is largely grayscale (intentionally so), but that there is a very subtle cyan “light” at the top of the screen. That can be easily disabled by just deleting it, or guiding / editing the “light” layer in the FLA. Great, but what to do if you just have no flash development environment on board, or can`t find the right layer?

They send me a sample_badge_without_cyan_effect.zip.
Grab it if you like. Maybe sometime there is a new version available.  Check it out at:
http://www.adobe.com/devnet/air/articles/badge_for_air.html

stevie AIR 1.5

Compiling Flex Themes Examples

March 18th, 2009

To use multiple styles, themes, skins from within flex we need to compile corresponding layout data to a sfw-file. Some examples bellow.

Compile a simple css file on windows to use it as switchable style (style.swf):

C:\FLEX\flex_sdk_3\bin\mxmlc C:\AIRSDK\pslrss\css\style.css

Compile a theme/skin from fillcolors.com on windows:

C:\FLEX\flex_sdk_3\bin\mxmlc

-include-libraries=
C:\AIRSDK\pslrss\themes\rainbow\CSSPlus.swc,
C:\AIRSDK\pslrss\themes\rainbow\Mate3.swc

C:\AIRSDK\pslrss\themes\rainbow\Rainbow.css

stevie AIR 1.5, Flex 3 , , , ,

Passing Variables to EventListeners in AS 3

March 6th, 2009

Instead of using anonymous functions we can write something like this to access variables from within eventListeners:


private classVar:String    = 'A string just for fun';

private function myClassFunction():void{

    var FunctionVar:String = 'A string just for fun';

    var myHandler:Function = function(e:Event):void{

        classVar           = 'Something else';

        FunctionVar        = 'Something else';

        trace('----Event.CLOSE-----');

        pslnote.removeEventListener(Event.CLOSE, myhandler);

        pslnote            = null;

        return;

    }//handlerEnd

    pslnote.addEventListener(Event.CLOSE,myHandler);

}//functionEnd

stevie Action Script 3

Wrapping Text in Flex

February 19th, 2009

Wrapping Text in Flex is sometimes difficult.
To eleminate white space use the attribute:

condenseWhite=”true”

…For example this could be done by using a Textarea:

mx:String id=”myTextVar” source=”./myText.html”
mx:TextArea id=”textArea”
htmlText=”{myTextVar}”
condenseWhite=”true”
width=”100%”
height=”150″
editable=”false”

stevie Flex 3

TextInput and rounded corners in Flex

February 19th, 2009

Default rounded corners do not work on Textinputs (textInputs) but a textinput can have rounded corners try this:

mx:TextInput cornerRadius=”10″ borderStyle=”solid”

Without the borderStyle set to solid it doesn’t work. This might work on different other components like boxes etc. too.

stevie Flex 3

Theme Chooser in Flex

February 10th, 2009

Have you ever tried to implement a theme chooser in Flex?
We know we have to compile the CSS files for a skin to a SWF to make this happen. But unfortunately the adobe livedocs dont tell something about the nessesarry unloadStyleDeclarations method:

StyleManager.unloadStyleDeclarations(oldStyleFile);

…which will prevent us from some random mysteriouse behavior ;-).
Here comes a complete AS 3 example for Flex:


< ?xml version="1.0" encoding="utf-8"?>

	
    
< ![CDATA[

    import mx.styles.StyleManager;

    [Bindable]
    private var themes: Array = [
        {label:"Smoke", data:"themes/Smoke/Smoke.swf"},
        {label:"Institutional", data:"themes/Institutional/Institutional.swf"},
        {label:"AeonGraphical", data:"themes/AeonGraphical/AeonGraphical.swf"},
        {label:"Shadow", data:"css/shadow.swf"},
        {label:"Default Flex Style", data:"css/style.swf"},
        {label:"Blend", data:"css/blend.swf"},
        {label:"Flex Skins", data:"css/flex_skins.swf"},
        {label:"Ice", data:"themes/Ice/Ice.swf"},
        {label:"Rainbow", data:"themes/rainbow/Rainbow.swf"},
        {label:"Carbon", data:"themes/carbon/carbon.swf"},
        {label:"yflexskin", data:"themes/yflexskin/yflexskin.swf"}

    ];

    private var oldStyleFile:String;

    private function myLoadStyle():void{
        var layout:String=theme.selectedItem.data;
        StyleManager.unloadStyleDeclarations(oldStyleFile);
        StyleManager.loadStyleDeclarations(layout);
        oldStyleFile = layout;
    }

    ]]>
	

	

Notice:

1. To avoid any flicker effects while switching themes, we can use fadeIn/fadeOut-flex-effects during style changes.

2. Style-Declarations have to be set equivalent from theme to theme. Otherwise we get some memory effect on forgotten declarations (still present styles after changing).

Exciting FLEX themes/skins can be found here:
http://www.scalenine.com/
http://www.fillcolors.com/
Unfortunately most of them require some modifications for special (or common) purposes ;-).

stevie AIR 1.5, Action Script 3, Flex 3 , , , , , , ,

Some modifications on Christophe Coenraets ORM Example

February 10th, 2009

In addition to Christophe Coenraets article “Using the SQLite Database Access API in AIR Part 3″ I made some modifications to enable inline editing and update the grid imidiately after every data change.


import mx.events.DataGridEvent;
private var em:EntityManager = EntityManager.getInstance();

public function saveItem():void
{
    em.save(contact);
    parentApplication.loadContacts();
}

public function saveItemInline(event:DataGridEvent):void
{
    var field:String = event.dataField;
    contact[field] =   event.currentTarget.itemEditorInstance.text;
    em.save(contact);
}

public function deleteItem():void
{
    em.remove(contact);
    parentApplication.loadContacts();
}

public function newItem():void
{
    contact = new Contact();
}

stevie AIR 1.5, Action Script 3, Flex 3 , , , , , ,

Sometimes a man needs to play…

February 9th, 2009

In the 80’s I payed 1 “Deutsche Mark” for every Astorid Game- never could imagine having this “onto” a personal blog site- just for free :-).


Click here to play Galaga!


Click here to play Galagon 2004



Click here to play Pacman II



Click here to play Strikers 1945



Click here to play Jetfighter



Click here to play Hybrid Fighter



Click here to play Space Bugs

stevie Lost and Found