View comments | RSS feed

Referring to external files

The source attribute of the <mx:Script> tag and the #include directive refer to files in different ways.

The following are the valid paths to external files that are referenced in an <mx:Script> tag's source attribute:

For an ActionScript #include directive, you can only reference relative URLs. You can specify file locations relative to the context root (start the location with a slash) or relative to the document root (omit the leading slash), as the following example shows:

#include "/myfiles/functions.as" // Relative to the context root. Resolves to 
 // /flex_app_root/myfiles/functions.as #include "functions.as" // Relative to the current document root (in this case,
 // in the same directory as the current document).

Flex searches the ActionScript classpath for imported classes and packages. Flex does not search the ActionScript classpath for files that are included using the #include directive or the source attribute of the <mx:Script> tag.


Version 1.5

Comments


yeo_31 said on Aug 14, 2005 at 6:53 PM :
#include directive always refers to external files from current mxml document root. I use Websphere 5.1, and no matter whether I start the relative path with a slash "/" or not, Flex refers to file from current mxml root and fails.

However, <mx:Script source="..." /> works fine for relative path.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000052.htm