Apr 14

The [Transient] and [Mixin] metadata tags

Tag: FlexDerek Wischusen @ 4:02 am

There are a couple useful metadata tags that are not particularly well documented in the Flex Livedocs that I have come across recently.

[Mixin]

The first is the [Mixin] metadata tag, which I saw a while back while reading about the RandomWalk component in the Flex docs for Creating Applications for Testing, but I never quite understood what it did until I came across this post by Adam Flater.

So, here is what it does: when you put the [Mixin] metadata just above your class definition and add a static init function to the class like so,

[Mixin]
public class Model
{
  public static function init (systemManager : ISystemManager)
  {
    trace ("I get called first")
  }
}

the static init function will be called as soon as your application loads (assuming this class is referenced somewhere in the app), much like static initialization blocks in Java, or static constructors in C#. This is useful if you have some code that you want to run before any of the other code in the class.

[Transient]

I just learned about this tag today from a comment by one the readers of this blog (thanks David).

The [Transient] tag is extremely useful for working with Value Objects because it allows you to tag properties that you do not want to send across the wire when the object is serialized.

For example,

package com.rxr.issuetracker.vo
{
  import com.adobe.cairngorm.vo.IValueObject;
  import mx.collections.ArrayCollection;
  [Bindable]
  [RemoteClass(alias="com.rxr.issuetracker.vo.Project")]
  public class ProjectVO implements IValueObject
  {
    private var _issues : ArrayCollection =  new ArrayCollection();

    public var id : int;

    public var user_id : int;

    public var title : String;

    [Transient]
    public function get issues () : ArrayCollection
    {
       return _issues;
    }

    public function set issues ( value : Array ) : void
    {
      _issues= new ArrayCollection(value);
    }
  }
}

Now when you send this ProjectVO across the wire to Rails (or PHP, ColdFusion, Java, .NET, etc) the issues ArrayCollection will not be sent with it.

As always, let me know if you have any questions or if any of this is unclear or incorrect. Also, please let me know if you know about any other useful metadata tags that are not included in the list on livedocs.

6 Responses to “The [Transient] and [Mixin] metadata tags”

  1. Phil Chung says:

    Wow, this is great stuff Derek! Thanks for sharing.

  2. Firdosh Tangri says:

    Thanks , this was really usefull info :)

    cheers :)
    Firdosh Tangri

  3. Adam Flater says:

    Very nice. Thanks for the info on [Transient] and thanks for the credit on the [Mixin] tag.

    -
    Adam Flater
    Software Architect
    effectiveUI
    adam.flater@effectiveui.com

  4. flexonrails.net » Blog Archive » Static initializations in ActionScript, Take 2 says:

    [...] a previous post I discussed how you can use the [Mixin] metadata tag to create a static initialization in Flex. Here is another way to do pretty much the same [...]

  5. Nisheet Jain says:

    Thanks derek for the info. [Transient] metatag is really useful. Though I discovered [mixin] very recently somewhere else

  6. 51AJAX.NET » ActionScript????static??????? says:

Leave a Reply

Canadian cialis no prescription
Cialis purchase online
Buy tramadol cod delivery
Phentermine usa
Buy phentermine hcl without prescription
Cialis no rx
Buy generic viagra india
Xanax 2mg bars
Xanax cost
Viagra ordering
Order xanax cheap
Buy phentermine online with no prescription
Cialis prescription online
Fast delivery cialis
Cost of prednisone
Viagra 50 mg price
Cialis brand
Viagra to buy in uk
Generic phentermine 37.5 without prescription
About phentermine
Propecia generic online
Propecia buy online
Viagra prescription free
Xanax generic 2mg
Generic cialis tadalafil
50 mg tramadol hcl
Cheap viagra cialis
Cialis 100mg pills
How to buy viagra online without prescription
Best price for phentermine
Buying xanax without a prescription
Phentermine hcl 37.5mg
Levitra online pharmacy
Cialis 5mg tablets
Levitra uk
Buy cheap tramadol without prescription
Canadian pharmacy viagra online
Phentermine 37.5 without prescription free shipping
Phentermine 37.5mg without prescription
Medication prednisone
Genuine cialis no prescription
Online cialis reviews
Ordering phentermine online
50 mg viagra online
Order levitra without prescription
Order phentermine cheap
Cheapest viagra professional
Valium pills effects
Non prescription viagra
Cheap viagra uk
Low price phentermine
Viagra mastercard
Buy phentermine with mastercard
Buy generic valium online
Cheap phentermine no rx
Tramadol cod fedex
Xanax buy uk
Cialis london
Where to buy phentermine
Cheapest viagra in uk
Buy viagra online in south africa
Buy genuine phentermine online
Valium buy online uk
Order valium without a prescription
Cheapest price viagra
Order propecia without prescription
Viagra online with prescription
Valium purchase
Cialis free sample
Cheap viagra in india
Female viagra uk
Low price cialis
Where can i buy valium in the uk
Valium no prescription uk
Cheap viagra pills
Phentermine 37.5 manufacturer
Order propecia online no prescription
Order valium cheap
Cialis online canada
Tramadol 100 mg
Online prescription propecia
Purchase valium without prescription
Phentermine us pharmacy
Cost of cialis 20 mg
Where to buy valium
50 mg tramadol
Genuine viagra
Doses of prednisone
Viagra cheap prices
Australia viagra prescription
Generic valium 5mg
Phentermine pills
Cheap viagra generic
Where to buy levitra online
Get phentermine without a prescription
Phentermine without prescription mastercard
Cheap generic xanax
Online cialis generic
Buy discount cialis
Buying phentermine in the uk
Valium online reviews
Buying viagra in the uk
Buy viagra professional
Levitra 10 mg
Phentermine diet pills
Viagra india
Best generic viagra prices
Viagra overnight delivery us
Cheap levitra uk
50mg viagra
Cheapest place to buy phentermine
Propecia without a prescription
About phentermine 37.5 mg
Cheap tramadol overnight delivery
Mail order phentermine
Purchase xanax online without prescription
Xanax overnight delivery
Free viagra samples
Cialis 20 mg tablets
Levitra generic online
Valium online no prescription
Generic viagra reviews
Xanax pills for sale
Propecia without prescription uk
Generic viagra in the uk
How to buy viagra over the counter
Prednisone pharmacy
Viagra usa pharmacy
Buy phentermine in uk
Viagra discount prices
Cheapest generic viagra online
Phentermine no prescription needed
Buy discount viagra online
Xanax drug generic
Viagra prescription australia
Cialis india pharmacy
How to buy viagra in uk
Order xanax
Generic cialis online pharmacy
Order tramadol cod
Buy cialis online from canada
Canadian pharmacy phentermine
Tramadol overnight no prescription
Free viagra samples without prescription
Where can i buy levitra
Buy cheap viagra uk
Prednisone online pharmacy
Generic viagra for sale
Buy real viagra
Cialis over the counter in canada
Buy phentermine no prescription
Generic viagra overnight shipping
Purchase phentermine without a prescription
Cheap valium online
Tramadol pharmacy online
Side effects of viagra
Online viagra prescriptions
Buy tramadol online canada
Xanax no prescription needed
Purchase viagra without prescription
Buy xanax bars no prescription
Order viagra online canada
Order cialis online without prescription
Canada viagra online without prescription
Buy phentermine without a prescription
Cheap viagra and cialis
Cheap viagra online uk
Buy xanax bars online
Viagra trial pack
Viagra suppliers
Valium without prescription australia
How to buy phentermine without a prescription
Xanax online without prescription
Valium prescription uk
Tramadol overnight fedex
Phentermine tablets 37.5
Best place to buy viagra uk
Valium online
Online viagra cheap
Phentermine purchase online
Xanax no prescription required
Best generic cialis
Valium without rx
Levitra medicine
Medication phentermine
Order phentermine without prescription
Levitra cheap
Viagra usa
Viagra free samples
Where can i buy phentermine online
Cialis low cost
Best viagra websites
Levitra lowest price
Canada cialis online
Non prescription levitra
Propecia online
Levitra 20 mg price
Buy viagra online without prescription uk
Buying prednisone
Buying cialis online
Buy viagra generic
Viagra pfizer canada
10 mg valium effects
Viagra fast shipping
Purchase phentermine online
Cialis professional online
Buy cheap cialis online
Cialis for sale in canada
Cialis online without prescription
Cheap phentermine without a prescription
Buy cialis in australia
Generic levitra from india
Valium prescription drug
Viagra suppliers australia
Buy valium uk
Buy prednisone no prescription
Cialis medicine
Best price on cialis
Viagra online pharmacy canada
Valium overnight delivery
Order xanax online uk
Prescription for cialis
Viagra discount coupons
Phentermine no rx
Tramadol hcl 50 mg tab mylan
Pharmacy valium
Valium online without prescription

Viagra pfizer price
Antidepressant tramadol
Best viagra generic
Xanax
Cheap tramadol without a prescription
Buy phentermine online without prescription
Buy viagra online canadian pharmacy
Buy phentermine hcl
Viagra online generic
Cialis 100
Online prescriptions for phentermine
Get tramadol online
Cialis no prescription canada
Viagra overnight shipping
Cialis from india
Prescription viagra online
Where to buy phentermine without a prescription
Cialis generic online
Brand cialis without prescription
Tramadol without a prescription
Best way to take valium
Viagra purchase uk