Pages

Wednesday, October 17, 2012

Ways of representing Flash Movieclip architecture as pseudo-code


Way-1: JSON
Here is a representation of a Movieclip architecture in JSON format.
{
  movieclip: {
    name: 'controller_mc',
    data: {
      frame: [
        {
          name: 'normal',
          data: {
            textfield: {
              name: 'caption',
              framespan: '4'
            },
            graphics: {
              color: '#333333'
            }
          }
        },
        {
          name: 'over',
          data: {
            graphics: {
              color: '#666666'
            }
          }
        },
        {
          name: 'down',
          data: {
            graphics: {
              color: '#999999'
            }
          }
        },
        {
          name: 'disabled',
          data: {
            graphics: {
              color: '#333333',
              alpha: '0.7'
            }
          }
        }
      ]
    }
  }
}
The same pseudo-code can be shown in a more compact manner.
{
  movieclip: {
    name: 'controller_mc',
    data: {
      frame: [
        {
          name: 'normal',
          layer: {
            textfield: { name: 'caption', framespan: '4' },
            graphics: { color: '#333333' }
          }
        },
        {
          name: 'over',
          layer: {
            graphics: { color: '#666666' }
          }
        },
        {
          name: 'down',
          layer: {
            graphics: { color: '#999999' }
          }
        },
        {
          name: 'disabled',
          layer: {
            graphics: { color: '#333333', alpha: '0.7' }
          }
        }
      ]
    }
  }
}
Way-2: XML
It can be also represented as XML tags that seems more sleek & compact.
<movieclip name="controller_mc">
 <frameset>
  <frame name="normal">
   <textfield name="caption" framespan="4"></textfield>
   <graphics color="#333333"></graphics>
  </frame>
  <frame name="over">
   <graphics color="#666666"></graphics>
  </frame>
  <frame name="down">
   <graphics color="#999999"></graphics>
  </frame>
  <frame name="disabled">
   <graphics color="#333333" alpha="0.7"></graphics>
  </frame>  
 </frameset>
</movieclip>

No comments:

Post a Comment