Showing posts with label Flex. Show all posts
Showing posts with label Flex. Show all posts

10 November, 2010

Flex: load external CSS


  1. Create and compile css file (mxmlc -static-rsls=true -output=out/style.swf src/style.css)

  2. Load this style file from the application (styleManager.loadStyleDeclarations('style.swf');)

28 March, 2010

Flex compiler locale

In order to switch flex compiler messages to US locale put this string "-Duser.language=en -Duser.region=US" into the $FLEX_HOME/bin/jvm.config file.

...
java.args=-Xmx384m -Dsun.io.useCanonCaches=false -Duser.language=en -Duser.region=US
...

17 October, 2008

emc

One more mine project: emc - remote file navigator.

It developed on:
  • Client side - Flex
  • Server side - PHP
  • RPC container - XML

This is just beta version.

It is possible to release complete version (add new functionality or implement another Server side, for example). And I'm looking for the people, who want to use this in their commercial projects.

20 September, 2008

Flex - autoscrolable text area

Need TextArea with automatic scrolling to bottom?
This is not trivial, but simple:


emc\components\AutoScrollableTextArea.as
package emc.components {
import mx.controls.TextArea;

public class AutoScrollableTextArea extends TextArea {
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
verticalScrollPosition = textField.numLines;
}
}
}

For example, it is useful for outputting log information.

18 September, 2008

Namespaces for custom Flex components

Flex (MXML) allow to declare custom components via xmlns declaration.
Like this:
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:emc="emc.components.navigator.*">

This way is useful when amount of custom components not too much and all components are located in the one or two packages.

But what about real namespaces like in Flex itself ("xmlns:mx="http://www.adobe.com/2006/mxml"); for huge amount of components?

It is possible to consolidate declaration of all components in the single file.
Like this:

manifest.xml
<?xml version="1.0"?>

<componentPackage>
<component id="Navigator" class="emc.components.navigator.Navigator"/>
<component id="Editor" class="emc.components.editor.Editor"/>
<component id="Console" class="emc.components.console.Console"/>
<component id="SmartTruncableLabel" class="emc.components.SmartTruncableLabel"/>
<component id="AutoScrollableTextArea" class="emc.components.AutoScrollableTextArea"/>
</componentPackage>
put this file into the project sources directory and add this argument to the MXML compiler:
-namespace=http://xantorohara.110mb.com/emc,sources/manifest.xml
and then use this components in the MXML files via this declaration:
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:emc="http://xantorohara.110mb.com/emc">
and insert component into your application:
...
<emc:SmartTruncableLabel id="titleLabel" styleName="filePanelTitleLabel" width="100%" />
...

How do you like it?

Enable Flex trace logging

Just create "C:\Documents and Settings\{UserName}\mm.cfg" file
with this content:
ErrorReportingEnable=1
TraceOutputFileEnable=1
and you will see Flex trace output in the "C:\Documents and Settings\{UserName}\Application Data\Macromedia\Flash Player\Logs\" directory.