February 23rd, 2007 by Kyle
Posted in: Flex, actionscript, mxml

This is installment 3 in the series.
The previous 2 related posts are:

Changing embedded True Type fonts at Runtime in Flex Applications

Using Modules to Change embedded True Type fonts at Runtime in Flex Applications

This approach is a little different.
The application is very similar, but instead of using a loader or module loading, I use the StyleManager to load a runtime CSS swf (which was compiled from a CSS file).

Here is one of the style sheets that is tuned into a CSS swf:

/* CSS file */
@font-face {
    src:url("assets/arial.ttf");
    fontFamily: myFont;
}

@font-face {
    /* Note the different filename for boldface. */
    src:url("assets/arialbd.ttf");
    fontFamily: myFont; /* Notice that this is the same alias. */
    fontWeight: bold;
}

@font-face {
    /* Note the different filename for italic face. */
    src:url("assets/ariali.ttf");
    fontFamily: myFont; /* Notice that this is the same alias. */
    fontStyle: italic;
}
 
@font-face {
    /* Note the different filename for bold-italic face. */
    src:url("assets/arialbi.ttf");
    fontFamily: myFont; /* Notice that this is the same alias. */
    fontWeight: bold;
    fontStyle: italic;
}

.myPlainStyle {
    fontSize: 11;
    fontFamily: myFont;
 }
 
.myBoldStyle {
    fontSize: 11;
    fontFamily: myFont;
    fontWeight: bold;
}

.myItalicStyle {
    fontSize: 11;
    fontFamily: myFont;
    fontStyle: italic;
}

.myBoldItalicStyle {
    fontSize: 11;
    fontFamily: myFont;
    fontWeight: bold;   
    fontStyle: italic;
}
 

Read the rest of this post»


6 Comments »

February 23rd, 2007 by Kyle
Posted in: Flex, actionscript, mxml

This is really part 2 in the series. Part 1 was Changing embedded True Type fonts at Runtime in Flex Applications

The interface that I have each font swf implementing is the same, so I have not posted the code.

The application has undergone some slight refactoring and I have added a few things.
I chose to use the ModuleManager.getModule(url) rather than using the mx:ModuleLoader tag.
The module Manager was more flexible and really should be used for loading non-visual modules.

Note the way that you get access to the loaded module after it has loaded:

 var ml:IModuleInfo = e.target as IModuleInfo;
 loadedFont = ml.factory.create()as IFontModule;
 

Read the rest of this post»


1 Comment »

February 21st, 2007 by Kyle
Posted in: Flex, actionscript, mxml

[Bindable] actually generates getter/setters, which then show up as accessors during introspection. This actually confused myself and a customer for a little while until I realized that of course, the binding generates getters and setters which means that what where once normal properties now are more than just properties. Run the code with the [Bindable] tag commented and uncommented to see the difference.

MyClass.as:

package {

    import mx.collections.ArrayCollection;

//  [Bindable]
    public class MyClass  {

    public var someNumber:Number;
    public var someString:String;
    public var someInt:int;

    private var _somePrivateString:String;
 
    public function MyClass()
    {
        this.someNumber = -1;
        this.someString = ‘’;
        this.someInt = 1;
   
    }
   
    public function get somePrivateString():String{
        return _somePrivateString;
    }

    public function set somePrivateString(s:String):void{
        _somePrivateString=s;
    }
  }
}
 

main.mxml:

<?xml version="1.0"?>
<!– usingas/IntrospectionAPI.mxml –>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="getDetails()">
    <mx:Script><![CDATA[
        public function getDetails():void {
            // Get the Button control’s E4X XML object description.
            var mcl:MyClass=new MyClass()
            var classInfo:XML = describeType(mcl);

            // Dump the entire E4X XML object into ta2.
            ta2.text = classInfo.toString();

            // List the class name.
            ta1.text = "Class " + classInfo.@name.toString() + "\n";

            // List the object’s variables, their values, and their types.
            for each (var v:XML in classInfo..variable) {
                ta1.text += "Variable " + v.@name + "=" + mcl[v.@name] +
                    " (" + v.@type + ")\n";
            }

            // List accessors as properties.
            for each (var a:XML in classInfo..accessor) {
                // Do not get the property value if it is write only.
                if (a.@access == ‘writeonly’) {
                    ta1.text += "Property " + a.@name + " (" + a.@type +")\n";
                }
                else {
                    ta1.text += "Property " + a.@name + "=" +
                        mcl[a.@name]" (" + a.@type +")\n";
                }
            }

            // List the object’s methods.
            for each (var m:XML in classInfo..method) {
                ta1.text += "Method " + m.@name + "():" + m.@returnType + "\n";
            }
        }
    ]]></mx:Script>
    <mx:Label text="Enumeration of MyClass.as’s properties, accessors and methods."/>
    <mx:TextArea id="ta1" width="400" height="200"/>
    <mx:Label text="E4X XML object description of MyClass.as"/>
    <mx:TextArea id="ta2" width="400" height="600"/>
</mx:Application>
 


No Comments »

February 12th, 2007 by Kyle
Posted in: Flex, Flex Builder, actionscript, mxml

I’ve had a few customers ask me how they can switch out embedded fonts at runtime. This really isn’t too difficult and basically involves loading swfs at runtime that have the appropriate fonts embedded within.
You register the font after the “font swf” is loaded and apply the newly loaded font to whatever components you like. Check out the code and comments below.

First I define an interface that I want all my font swf classes to implement so I know how to determine what font(s) are loaded.

IFontModule.as:

package
{
    public interface IFontModule
    {
        function get fontName_Normal():String;
        function get fontName_Bold():String;
        function get fontName_Italic():String;
        function get fontName_BoldItalic():String;       
    }
}

Read the rest of this post»


1 Comment »

February 12th, 2007 by Kyle
Posted in: Flex, Flex Builder, Flex Data Services, Flex Automated Testing, Flex Charting

I just published two Tech note articles for Flex regarding changes to Daylight Savings time in effect for 2007 and Sun’s JVM changes regarding this:

“How to upgrade the JVM shipped with Flex”

and

“Flex and Sun’s JVM: U.S. Daylight Saving Time changes in 2007″


No Comments »

February 12th, 2007 by Kyle
Posted in: Flex, Flex Builder, Flash Player

RSS feeds are a good way to stay on top of news regarding your favorite product.
This is a good way to stay aware of the latest tech notes or new product announcements.
I encourage all my customers to subscribe to Flex, Flex Builder and Flash Player Feeds.
These feeds and others from Adobe can be found here:

http://www.adobe.com/support/rss/


No Comments »

February 6th, 2007 by Kyle
Posted in: Flex Builder

I have run into a few customer issues that could be traced to them not having successfully upgraded to Flex Builder 2.0.1.
(I believe upgrading from the last GMC to the Final release was supposed to work, but upgrading from earlier GMCs was not.)
Whatever the case, if you need to know what build you are using here are the directions to find it in either the Standalone version of Flex Builder or the Eclipse plugin version:

If using Flex Builder Standalone, if you go to:

Help/Product Details/… and click on Feature Details.
You should see the Flex Builder2 feature version #

If using the Eclipse Plugin, if you go to

Help/About Eclipse SDK/ …and click on Feature Details.
You should see the Flex Builder2 feature version #

For the Flex Builder 2.0.1 release, the version# should be 2.0.155577


No Comments »

February 5th, 2007 by Kyle
Posted in: Flex, Flash Player, actionscript, mxml

I’ve been asked this by at least 4 customers and provided them with simple samples that set the stage.quality = StageQuality.BEST. This provides smoother image scaling, but at potentially some performance cost. You also have to use the loaded image’s content property, casting it to a bitmap in order to scale it. I don’t recall exactly where I found the info on this, but I Googled and didn’t find a good reference for doing this, so I thought I’d post my own solution.

Check out the code snippet:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    applicationComplete="stage.quality = StageQuality.BEST">
   
    <mx:Script>
        <![CDATA[
            private function handleImageComplete(event: Event): void {
                var bitmap: Bitmap = ((event.target as Image).content as Bitmap);
                if (bitmap != null) {
                    bitmap.smoothing = true;
                }
            }
        ]]>
    </mx:Script>
   
    <mx:HSlider id="zoomSlider"
        height="150"
        buttonMode="true" useHandCursor="true"
        minimum="1" maximum="10"
        snapInterval="1" tickInterval="1" value="1"/>
   
    <mx:Image height="600" width="800"
        scaleX="{zoomSlider.value}" scaleY="{zoomSlider.value}"
        source="me.jpg" complete="handleImageComplete(event)" />
</mx:Application>

No Comments »

February 5th, 2007 by Kyle
Posted in: Work

And just to cover myself, I thought I’d post this legal disclaimer:

The postings on this site are my own and don’t necessarily represent Adobe’s positions, views, strategies or opinions.

That should cover it.

-Kyle


No Comments »

February 2nd, 2007 by Kyle
Posted in: Flex, actionscript, mxml

I had a customer request some help in modifying the default Flex ComboBox behavior such that when the dropdown list was open and a user was scrolling the mousewheel with the mouse outside the dropdown list, the dropdown list would scroll. The default behavior is to close the dropdown list as soon as the user scrolls the mousewheel outside the dropdown list.

Read the rest of this post»


No Comments »

« Previous Entries


Professional Medicines, Online Pharmacy buy clomid buy viagra buy cialis buy tramadol buy soma buy levitra buy propecia buy ultram buy acomplia buy phentermine buy xenical buy kamagra Online Pharmacy Products
cialis consultation delivery discount health man cialis cialis forum cialis side eefects low cost generic generic cialis pills effectiveness viagra levitra cialis cheapest generic viagra and cialis pills cat 6 cialis bargain levitra levitra cialis dysfunction erectile levitra viagra 2003 cyalis levitra market sales viagra clarinex stimula levitra aldara pay pal order diflucan viagra, cialis, levitra, diflucan, clomid buy generic soma dream levitra online order pharmaceutical zithromax price soma prescriber information soma aura soma color therapy essences soma carisoprodol 350mg soma restaurant scottsdale buy pfizer viagra viagra buying online story viagra viagra before and after viagra substituts modo de empleo viagra viagra suppositories side effects viagra testemonials viagra videos