The prefix "yworks" for element "yworks:GraphCanvasComponent" is not bound

Troubleshooting

Summary

This article describes how to fix an error like "The prefix "yworks" for element "yworks:GraphCanvasComponent" is not bound".

Description

The error "The prefix "xxx" for element "xxx:yyy" is not bound" indicates that an (XML) attribute name or element name has a prefix but no matching namespace was found.

Adobe flex elements usually use "mx:" as prefix. If you are using Flex Builder, the matching namespace definition is already generated when a new MXML application is created:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

</mx:Application>

With yFiles FLEX, the most convenient way for adding a GraphCanvasComponent to the application's UI is by adding a <yworks:GraphCanvasComponent/> tag to the MXML part of the application's source. Additionally, one has to define the namespace "yworks" by adding the attribute xmlns:yworks="http://www.yworks.com/xml/yfiles-flex/1.3/mxml" to the opening tag of the top level container:


<mx:Application 
  xmlns:mx="http://www.adobe.com/2006/mxml" 
  xmlns:yworks="http://www.yworks.com/xml/yfiles-flex/1.3/mxml"
  applicationComplete="init()">

If you use Flex Builder's code completion (ctrl-space) to insert the <yworks:GraphCanvasComponent/> tag the namespace will automatically be defined.

Note that with yFiles FLEX versions prior to 1.3 the namespace has to be defined as xmlns:yworks="com.yworks.ui.". This is similar to an import statement in the actionscript part: import com.yworks.ui.;

Categories this article belongs to:
yFiles FLEX > Other
Applies to:
yFiles FLEX: 1.4, 1.5, 1.6, 1.7, 1.8
Keywords:
mxml - namespace - prefix - error