I get it. I was asking more as a way to simply cleanout the code when it gets 
too long but your way makes it dynamic. Great!

Thanks. I'll look into it.

-David




________________________________
From: Fotis Chatzinikos <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Sunday, November 30, 2008 8:29:23 AM
Subject: Re: [flexcoders] sailorsea21 - is there an "include" command in Flex 
that acts likes PHP include?


Hi,

I think that you do not understand exactly how to use mxml and custom 
components.. . You do not "include" mxml (as you would do in php, its more like 
java or another object oriented language... You make a new 'class' (component 
in our case, and then use):

A quick pseudocode example:

File MyComponent. mxml:

<canvas>
  <script>
    [Bindable]
    public var thetitle:String = "" ;
  </script>
  <label text="{thetitle}"/>
</Canvas> 

And then in main application to use it and set its title label:

<application>
...other staff...
<some container or whatever really>

     <MyNamespace: MyComponent thetitle="Hello World"/>

...

Note: you need to register MyNamespace with a line similar to:

<mx:Application 
    xmlns:mx="http://www.adobe. com/2006/ mxml" 
    xmlns:MyNamespace="com.myself.componen ts.*"

Hope it helps... Read some tutorials... There are lots available :-)

Fotis


On Sun, Nov 30, 2008 at 3:09 PM, - - <sailorsea21@ yahoo.com> wrote:

Hi Ben, but what if I'd like to include some MXML ? Is it possible?
Thank

-David




________________________________
From: ben gomez farrell <[EMAIL PROTECTED] com>
To: [EMAIL PROTECTED] ups.com
Sent: Friday, November 28, 2008 4:09:14 PM
Subject: Re: [flexcoders] sailorsea21 - is there an "include" command in Flex 
that acts likes PHP include?



yah its real easy just do a script block, but point to a source instead 
of enclosing it in a cdata block.
So something like <mx:script source="mycode. as" />

The included code wouldn't be a class or anything, just a series of 
methods and variables (like you'd want from an include)
ben

sailorsea21 wrote:
>
> Hi everyone, I would like to clean up my main mxml file since it's
> getting farely big. Is there an "include" command that will allow me to
> split up my MXML code in several MXML files. Something like the PHP
> INCLUDE command?
>
> Thanks.
>
> 




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
Fotis.Chatzinikos@ gmail.com, 
 


      

Reply via email to