Writing AS3, building in MXML – Doh?

I’ve just started shaving a goat, or yak, or whichever the ungulate of choice is this season. These are my steps so far.

  1. Trace out an API in MXML .
  2. But I can’t do that, because MXML won’t let me do what I want (yet).
  3. Master writing AS3 for building in MXML
  4. But I can’t do that, because I can’t find any references on the subject and none of my experiments have worked
  5. Write a blog about it.
  6. Yep, I can do that…


Update: solved – (or possibly never broken in the first place)
This I understand:

  • each State is created and added to the FSMDeclaration values property.
  • the id tag also means that it is added to the FSMDeclaration with its given id as its key
  • the FSMDeclaration.initial value is set as the s1 instance of State.


Now look at these from the Flex framework:

Both instances of the Move Class (m1 and m2) are added to the children property of the parent Sequence. S1’s syntax is the same as my first (“this I understand”) example, as it uses the [DefaultProperty] tag, but what about s2? I can’t get this to work, what’s the magic formula?


Lets imagine I’ve solved (with your help) problem one:

Consider State s1. What I want to do is add a transition to it, but I don’t want to create a new one, I want to insert Transition t1, already created in the transitions property (the ref attribute is my own pseudo-syntax to describe what I want to do).

As I write, another way has occurred to me:

which would work, but to me is not so visually explanative.

Thank you for your help.

5 thoughts on “Writing AS3, building in MXML – Doh?

  1. Problem 2:
    AFAIK <fsm:Transition will always create a new instance. Option 2 seems to me the only viable one.

    Problem 1:
    Do you mean to say

    doesn’t work? Because it should.

  2. Problem 2: AFAIK mxml always creates a class instance. That’s how it’s wired. If you want the first syntax, you could create a class that wraps a reference so the mxml is like this

    then unwrap the reference inside the State class, or maintain the wrapper and have it implement the same interface as the transition itself.

Leave a Reply

Your email address will not be published. Required fields are marked *