---
id: 113
title: 'Adobe Flex : Event/Action binding in MXML and AS'
slug: adobe-flex-eventaction-binding-in-mxml-and-as
date: '2008-06-14T14:57:00Z'
modified: '2008-06-14T14:57:00Z'
status: publish
type: post
author: pmoelgaard
categories:
  - ActionScript 3.0
  - Adobe Flex
tags:
  - Best Practices
excerpt: null
canonicalPath: /posts/adobe-flex-eventaction-binding-in-mxml-and-as
featuredImage: null
commentCount: 0
wordCount: 117
readingTimeMinutes: 1
hasMedia: false
hasVideos: false
url: >-
  https://forwardthinking.pemo.me/posts/adobe-flex-eventaction-binding-in-mxml-and-as
---
Try to avoid mixing and matching MXML and ActionScript event/action binding. This is also more of a recommendation then a requirement. If you start binding the creationComplete or click events in MXML try to bind them all in MXML. If you bind your events in ActionScript try to bind all of them in ActionScript. Once you start mixing and matching it can be hard to track down code flow later on. You may find yourself wondering why an event keeps triggering because you left it in MXML and forgot about it. In my above example I bind the click event. You can easily do this in the initilize() method using addEventListener(). Use what works best for you.
