Mike Orth – Booya!

Flex, Actionscript

Increase Memory in Flash Builder / Eclipse for Mac OS

If you ever get the eclipse “Out of Memory” error, then you need to increase the default memory size. It’s relatively easy, but you have to know where to look.

In your eclipse install folder, right click on the Eclipse launcher and choose “Show Package Contents”. Then navigate to Contents/MacOS and open eclipse.ini. Change the min & max values to:

-Xms128m
-Xmx512m

No comments

360|Flex San Jose

I just got back from 360|Flex conference in San Jose. I got to meet a lot of cool people, as well as put faces to several fellow Universal Mind guys. At past 360s, you had to search to find someone with a PC because it was overwhelmingly Macs, but I was surprised at the amount of PCs I saw this time. There was also a lot of focus on mobile development. Looking forward to next time.

1 comment

Playing with 3D Rotation in Flex 4

I wanted to experiment with the new 3D features in Flex 4 Gumbo, so I made this simple rotate demo. Your mouse controls the rotation of the paw. I used the new functionality of

AnimateFilter

&

SimpleMotionPath

for the ‘info’ button effects and when clicking the paw. Rather than use the Rotate3D effect, I am just setting the rotation properties on MouseMove.

Click for demo

3d Paw Logo

This was done for my good friends at CFBgaming.com.

1 comment

Skinning Flex 4 slides, Uber-Basic Example Button Skin

Here are my slides from Flex Flash Camp along with an uber-basic example button skin that shows a quick breakdown of a Spark Skin. Great for those who haven’t had time yet to really peer into Flex 4 skins. Look for more advanced skinning topics soon.

<?xml version="1.0" encoding="utf-8"?>
<!--
     UBER-BASIC BUTTON SKIN EXAMPLE
       Demonstates:
         - States
         - FXG Graphics
         - Skin Parts  
     Mike Orth 2009
-->
<s:Skin
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/halo"
    >
   
   
    <fx:Metadata>
        [HostComponent("spark.components.Button")]
    </fx:Metadata>
   
    <!--SKIN STATES-->
    <s:states>
        <mx:State name="up"/>
        <mx:State name="down"/>
        <mx:State name="over"/>
        <mx:State name="disabled"/>
    </s:states>
   
   
    <!--graphical elements-->
    <s:Rect top="0" bottom="0" left="0" right="0">

        <s:stroke>
            <mx:SolidColorStroke color="0x000000"/>
        </s:stroke>
        <s:fill>
            <mx:SolidColor color="0xFF00CC"/>
        </s:fill>
    </s:Rect>
   
    <!--SKIN PARTS-->
    <s:SimpleText id="labelElement"
        top="5" bottom="5" left="20" right="20" />
</s:Skin>
3 comments

Flex Flash Camp Presentation, slides on Flex 4 Skinning coming soon

My presentation on Skinning in Flex 4 from the Adobe User Group Tour & Flex / Flash Camp will be up soon.  It covers the basics of what has changed for skinning and styling.  The demos walk you through creating a new skin and how certain aspects affect the end result.  I had a great time meeting more people from 615Flex.  Matthew did an awesome job of getting the event organized and off the ground.

Special thanks to Greg Wilson from Adboe, all the attendaes & presenters.

Flex / Flash Camp, Adboe User Group Tour

4 comments

Flash Builder 4 Beta / FB3 – “Removing compiler problem markers” error

If you’ve played with the new Flash Builder 4 Beta, you may have wanted to test out your existing projects in it.  And like me, you may have just quickly pointed it to an existing workspace to import a project.  If you haven’t – DON’T.  Once you switch back to Flex Builder 3, you will start getting An internal error occurred during “Removing compiler problem markers…”

This is because FB4 is built on a different version of Eclipse and modifies your workspace files (not your .project files), i.e. it hoses your existing workspace. To get rid of it, just create a new workspace in FB3 and import your projects there.

2 comments

How to use a DataGrid with no column headers

This is one of those quirky things that is not all that well documented.  I had a client that needed a datagrid but didn’t want the header row.  It sparked the memory of struggling to find how to do this the first time I needed it.  So hopefully this will help end your search for the answer

<mx:DataGrid showHeaders=false/>
No comments

Easily Validating Dynamic Forms (or with just ‘too many’ fields)

Don’t you hate having to specify validation on each individual control in your form? Or how about when project management is continually adding new form fields to a form? “A user should have to retype an email address” or, “we need to add a billing address section.” Well now rather than having to add a new validator source or explictly call validate() for the new control, this code takes care of it all automatically. This works especially great for forms with dynamic fields.

Just add the FormItem to your form, set it to required and you’re set! Simply call

validateForm(form:Form)

passing in any Form object and it will create an array of all the fields inside of the form. Since mostly you’ll be dealing with TextInput controls in your FormItem, that’s what this example uses. See comments in example code for more detailed information on usage.

Click to view demo app (Right click to View Source)
Click to view app (Right click to View Source)

Sample code:

        /**
         * Helper function that returns all the fields for a
         * given form. Pass in requiredOnly = true if you only want
         * the required fields.
         */
        private function getFields(form:Form, requiredOnly:Boolean=false):Array
        {
            var a:Array = [];
            // get every child of the Form
            var formItems:Array = form.getChildren();
            for (var i:int=0; i<formItems.length; i++)
            {
                // make sure it's a FormItem - if you use FormHeading or have
                // items that are not wrapped in a FormItem tag then ignore those
                if (formItems[i] is FormItem)
                {
                    var formItem:FormItem = formItems[i];
                    // add the formItem's child to the array.
                    // if you only need required items, set requiredOnly = true
                    // Note: this assumes you only have one form field per FormItem
                    //       You could easily add additional logic here for more
                    if (formItem.required || !requiredOnly)
                        a.push(formItem.getChildAt(0));
                }
            }
            return a;
        }
       
        /**
         * Validates all fields in a given form.
         */
        private function validateForm(form:Form):Boolean
        {
            // reset the flag
            var _isValid:Boolean = true;
           
            // populate the fields - if your fields aren't dynamic put this in creationComplete
            var fields:Array = getFields(form, true);
           
            for each(var source:UIComponent in fields)
            {
                // create a simple string validator
                var validator:StringValidator = new StringValidator();
                validator.minLength = 2;
                validator.source = source;
                validator.property = "text";
                var result:ValidationResultEvent;
                // typical validation, but check to this checks for any different
                // types of UIComponent here
                if (source is TextInput)
                    result = validator.validate(TextInput(source).text)
                else if (source is TextArea)
                    result = validator.validate(TextArea(source).text)
                // if the source is valid, then mark the form as valid
                _isValid = (result.type == ValidationResultEvent.VALID) && _isValid;
            }
           
            return _isValid;
        }

4 comments

TitleWindow Subclass for Easily Handling Popups

Typically if you choose to use a TitleWindow, odds are you’re going to add it with the PopupManager and use the Close button. So rather than having to always set that up and add listeners for the CloseEvent, use this extended class PopupBase. It’s used the same as TitleWindow, declared in actionscript

var popup:PopupBase = new PopupBase();

or mxml,

<containers:PopupBase />

but by default it:

  • sets showCloseButton=true
  • sets a listener for CloseEvent
  • removes the popup when Close button is pressed

You can override the onClose handler to add different functionality.

package containers
{
    import mx.containers.TitleWindow;
    import mx.events.CloseEvent;
    import mx.managers.PopUpManager;
   
    public class PopupBase extends TitleWindow
    {
        public function PopupBase()
        {
            showCloseButton = true;
            addEventListener(CloseEvent.CLOSE, onClose);
        }
       
        protected function onClose(event:CloseEvent):void
        {
            PopUpManager.removePopUp(this);
        }
    }
}
No comments

MediaCoreLib for Actionscript 3 – Play Rich-Media Content Easily

MediaCoreLib – Here’s an easy way to play rich media content (audio, video) inside Flash or Flex and manage it all in one place.

The new MediaCoreLib alpha release includes an extensive PlaylistManager as well as a merging of my FadingSound component to allow for crossfading between tracks. For a more info check out the Google code repository.

Features:

  • Play
  • Pause
  • Stop
  • Prev / Next
  • Rewind / Fast-forward
  • Repeat
  • Preloading and Caching
  • Fade In / Out
  • Crossfade
  • More…

Check out the testing panel to try it out yourself:
BASIC PANEL
ADVANCED PANEL

This is an effort bewtween Justin Opitz and myself and we are continuing to add features. Look for a Beta release soon!

2 comments

« Previous PageNext Page »

Mexico

Google Tracking Code